Classes, Structs, and Objects—Creating Objects
| CSharp-Online.NET:Articles |
| C# Articles |
|
© 2006 Weldon W. Nash, III |
Creating Objects
Object creation is a topic that looks simple on the surface, but in reality is relatively complex under the hood. You need to be intimately familiar with what operations take place during creation of a new object instance or value instance in order to write constructor code effectively and use field initializers effectively. Also, in the CLR, not only do object instances have constructors, but so do the types they’re based on. By that, I mean that even the struct and the class types have a constructor, which is represented by a static constructor definition. This capability doesn’t exist in languages such as native C++, so it may be a new concept to you. Constructors allow you to get work done at the point the type is loaded and initialized into the application domain.
|

