ClassWithProperties Class
Namespace: CloudNimble.DotNetDocs.Tests.Shared.BasicScenarios
Assembly: CloudNimble.DotNetDocs.Tests.Shared.dll
📋 Definition
public class ClassWithProperties
📝 Summary
Demonstrates different property patterns including auto-properties, read-only properties, and computed properties.
🎯 Members
AutoProperty
public string AutoProperty { get; set; }
Standard auto-implemented property with public getter and setter.ReadOnlyProperty
public string ReadOnlyProperty { get; }
Read-only property that can only be set in the constructor.ComputedProperty
public string ComputedProperty => $"Computed: {AutoProperty}";
Expression-bodied property that computes its value.PrivateSetProperty
public int PrivateSetProperty { get; private set; }
Property with public getter but private setter.
💡 Usage Examples
var obj = new ClassWithProperties
{
AutoProperty = "Value"
};
Console.WriteLine(obj.AutoProperty); // "Value"
Console.WriteLine(obj.ComputedProperty); // "Computed: Value"