Definition:-A static is a keyword or a modifier. The static keyword can be used with a class, field, method, property, operator, events or constructor without any instance or object. The static member's which we declared can be accessed directly with a type (syntax) <class name>.<member's name>.
Code:- Using system; namespace static_variables { class om { public static string name, location; public static int age; public static void Get_Details(); { Console.WriteLine("Name-{0},Location-{1},age{2} ", name,location,age); } } class details { static void Main(string[] args) { om.name="Vivekanand"; om.location="Jhunsi"; om.age= 20; } } }
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Definition:- A static is a keyword or a modifier. The static keyword can be used with a class, field, method, property, operator, events or constructor without any instance or object. The static member's which we declared can be accessed directly with a type (syntax) <class name>.<member's name>.