When does the “fat arrow” (=>) bind to “this” instance

The fat arrow binds at 3 occasions when declaring a method when declaring a function within a method when declaring a function in global context 1. When declaring a method When the Coffeescript compiler encouters the following syntactical pattern within a class declaration class A somemethod: (paramlist) => This will yield the following code within … Read more

The ‘this’ keyword as a property

It is indexer. After you declared it you can do like this: class MyClass { Dictionary<string, MyType> collection; public MyType this[string name] { get { return collection[name]; } set { collection[name] = value; } } } // Getting data from indexer. MyClass myClass = … MyType myType = myClass[“myKey”]; // Setting data with indexer. MyType … Read more

Passing “this” in java constructor

Passing this to another method/object from inside the constructor can be rather dangerous. Many guarantees that objects usually fulfill are not necessarily true, when they are looked at from inside the constructor. For example if your class has a final (non-static) field, then you can usually depend on it being set to a value and … Read more