|
|
|
|
| |
[051] Sealed Class |
26/01/2018 |
|
Sealed class is a class from which we cant inherite.
In the next code we can see the use of sealed class and sealed method. |
|
Download: | Explanation |
|
|
|
| |
[052] protected access modifier |
21/04/2013 |
|
The Protected Access Modifier enables access to protected members only from classes that inherit from the class in which the protected members were defined.
In the next code we can see a base class named Person that contains a field with a protected access modifier that only classes that inherit from the base class can access to this field. |
|
Download: | Explanation |
|
|
|
| |
[053] Destructor |
26/01/2018 |
|
The purpose of the Destructor function is to make last actions right befor clearing the object,by overriding the Finalize method that defined in the object class.
In the next code we can see the way of defining a Destructor,overrding the Finalize method and forcing the Garbage Collector to collect immediately the objects without a reference by using the GC.Colletion method. |
|
Download: | Explanation |
|
|
|
| |
[054] IDisposable interface |
26/01/2018 |
|
When we want to release an objects resources immediately when it losts a reference,we can use the Dispose method that implements the IDisposable interface.
In the next code,we can see that class contains a Destructor and inherits from IDisposable interface.
The Dispose method contains a call to the GC.SuppressFinalize in order to avoid calling the Destructor after calling the Dispose method. |
|
Download: | Explanation |
|
|
|
| |
[055] Indexer |
29/07/2016 |
|
The Indexer enables us to access to a class members by a key-value mechanism.
In the next code we can see how to define an Indexer in a class,that is the same way as Properties has a get-set accessors.
In this example we will demonstrate using Indexer with a string indexer. |
|
Download: | Explanation |
|
|
|
| |
[056] Indexer |
29/07/2016 |
|
The Indexer enables us to access to a class members by a key-value mechanism.
In the next code we can see how to define an Indexer in a class,that is the same way as Properties has a get-set accessors.
In this example we will demonstrate using Indexer with a numeric indexer. |
|
Download: | Explanation |
|
|
| |
|
|