PostSharp 2023.0 / / Post­Sharp Documentation / API Reference / Post­Sharp.​Reflection Namespace / Reflection­Extensions Class / Reflection­Extensions Methods / Reflection­Extensions.​Get­Automatic­Property Method / Reflection­Extensions.​Get­Automatic­Property Method (Field­Info)

ReflectionExtensions.GetAutomaticProperty Method (FieldInfo)

Gets the PropertyInfo whose a given field is the backing field from the current type or base types.

Namespace:  PostSharp.Reflection
Assembly:  PostSharp (in PostSharp.dll) Version: 2023.0.3.0 (2023.0.3.0)
public static PropertyInfo GetAutomaticProperty(
	this FieldInfo field


Type: System.Reflection.FieldInfo
A field.

Return Value

Type: PropertyInfo
The PropertyInfo representing the property whose field is the backing field, or null if field is not the backing field of an automatic property.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type FieldInfo. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also