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, Boolean)

ReflectionExtensions.GetAutomaticProperty Method (FieldInfo, Boolean)

Gets the PropertyInfo whose a given field is the backing field and specifies whether base types should be considered.

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


Type: System.Reflection.FieldInfo
A field.
Type: System.Boolean
true if the property should be looked for in the base, otherwise false.

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