c# property set default value and used it in class code example Example: c# auto property set default value public int X { get; set; } = x; // C# 6 or higher