Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- namespace CSharpTest
- {
- class Account
- {
- public static int staticValue;
- public int instanceValue;
- static Account() => staticValue = 10; // is called once then there is any usage of static value or creating first class instance
- public Account(int value) => instanceValue = value;
- public static int StaticVaule { get; set; }
- public int InstanceValue { get; set; }
- }
- class Program
- {
- static void Main(string[] args)
- {
- CultureInfo.CurrentCulture = new CultureInfo("en-US", false);
- Console.WriteLine(Account.staticValue); // 10
- Account.staticValue = 14;
- Console.WriteLine(Account.staticValue); // 14
- Account acc = new Account(100);
- Console.WriteLine(Account.staticValue); // 14
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement