Posts

Showing posts with the label Attributes

Attributes In C#

Image
Attributes – Used to provide the information to compiler about the behavior of class/assemblies and this information can be used by the reflection. Example 1.        Obsolete 2.        WebMethod 3.        Serializable How to use Obsolete Attribute class Program     {         int result = new Calculator ().AddTwoNumbers(1,2);     }         public class Calculator     {         [ Obsolete ( "This method is obsolete, Use new method AddNumbers(List )" )]         public int AddTwoNumbers( int num1, int num2)         {             return num1...