Monday, March 26, 2012

Serializable

What is the differenece between serializable & serializable() attribute of the class?

which one should we use?

Hi,

The common language runtime allows you to add keyword-like descriptive declarations, called attributes, to annotate programming elements such as types, fields, methods, and properties. Attributes are saved with the metadata of a Microsoft .NET Framework file and can be used to describe your code to the runtime or to affect application behavior at run time. While the .NET Framework supplies many useful attributes, you can also design and deploy your own.

The attribute is emitted into metadata when you compile your code and is available to the common language runtime and any custom tool or application through the runtime reflection services.

Here is reference:http://msdn2.microsoft.com/en-us/library/aa720076(VS.71).aspx

And using attribute is better in .NET .

Hope this helps


There is no difference between the following statements:
[Serializable]public class MyClass{}
And
[Serializable()]public class MyClass{}
They are the same. If there are no parenthesis, it calls the default constructor of the attribute.

hi,

thanks to all of u who gave my reply and I am sorry for this late response.......

0 comments:

Post a Comment