Tuesday, August 5, 2008
A struct is a value type and a class is a reference type.
When we instantiate a class, memory will be allocated on the heap and for struct gets initiated, it gets memory on the stack.
Classes can have explicit parameter less constructors. But structs dosn't have this.
Classes support inheritance.
No inheritance for structs
A struct cannot inherit from another struct or class, and it cannot be the base of a class. Like classes, structures can implement interfaces.
Also Read other Top Articles
- JSON Serialization in VS 2008
- Implementing Forms Authentication in Silverlight Application.
- Making GridView Rows or Individual Cells Clickable and Selectable.
- Enabling browser back button for GridView Paging and Sorting in Ajax 1.1 and 3.5 (using Visual Studio 2005/ Visual studio 2008)
- How to pass values from User Control to Page or calling Page methods from User Control.
- What is WCF?
- New features in C# 4.0
- C# to VB.NET and VB.NET to C# online free converter tools.