int CurrentHealth { get; set; }
CurrentHealth = 100;
int CurrentHealth
{
get { .. }
set { ... }
}
class TestClass
{
private int _a;
public int A
{
get { return _a; }
set { _a = value; }
}
public int B { get; set; }
}
var testClass = typeof(TestClass);
var fields = testClass.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
foreach (var fieldInfo in fields)
{
Console.WriteLine(fieldInfo.Name);
}
// результат:
// _a
// <B>k__BackingField