Super crazy C# doubts resolved in code
Tests the priority of Optional Parametric overload vs exact match overload. It also test the sizeof for custom structs with and without fields. An absolute match has higher priority than overloaded match with optional parameters.
Inheritance through virtual, override, new and new virtual methods. Every new method with same name as in parent will create a new child method with same name and both will exists. To call the base version, we have to use the base reference.
Static directives holding to two methods with same name in different classes. In such scenerios we have to Call them with fully qualified name.
Call by reference for reference types using ref allows to change the whole object itself and replace it with new object
Determines the order of object initializer and parametric constructor, always constructors calls first follwed by object initializers
Shows how to call async methods in a console app using Task.Run delegate and awaiting the result using GetAwaiter() call
Shows that while boxing both the Value and the Type are stored with in the wrapped object. And hence we cannot unbox the object back to any other type that is compatible with the original boxed type. You can only unbox using the cast to the original type and assign to any compatible type but the unboxing cast should be only to the boxed type.
Shows how to access a common resource by multiple threads through lock statement in multithreaded program.
Shows how the AutoResetEvent in a multi threaded program is used to signal the events to wait till the AutoResetEvent is Set or Reset.
Shows how an exception is raised in a checked context in run time if the overflow bit is set.
The inner most enclosed context will get the priority to throw or surpress the run time overflow exceptions.
Shows that a enum can inherit the integral value type and also how to use the enum for the bit flag operations using the Flag attribute on the enum declaration.
Shows how to implement event using the Framework Guidlines.
Shows that the event is just an access modifier on the delegate to declare that particular delegate as an event handler.
Defines a custom delegate to implement an event behaviour as the framework's EventHandler delegate.
Contains a Delegates class that contains the common delegates that the framework provides as its properties that can hold an methods with their corresponding signatures.
This shows how a collection is affected by using the foreach iterator and modifying the collection with in the loop. Generally they are cached for performance and hence the iteration will continue on the initial collection.
It also shows that the collection need not to implement the IEnumerable and the IEnumerator interfaces to be eligible for the foreach loop.
This shows how to catch the exceptions in an async method. This method is not a standard and need not hold good for debugging the exception. But it shows that it is possible to catch the exceptions that occur in async method.
Shows how to parse and traverse an expression tree in c#. It also shows how to use a delegate to create and call a method on the fly at the runtime.
Shows how Observer pattern is implemented in C# using the IObserver, IObservable and IDisposable interfaces. Basically Observable holds a list of Observers that subscribe to them and returns a Disposable to those observers so that when ever they want to unsubcribe, they can use the Disposable to unsubscribe.
Shows the basic difference between a const and a readonly variable. The main difference is that const should be initialized in declaration, but readonly can be initialized in constructor as well.