AdvantageCMS.Core.Admin.BaseClasses Namespace
AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

BusinessObjectBase..::..GetPropertyName<(Of <(<'T>)>)> Method (Expression<(Of <(<'Func<(Of <(<'T>)>)>>)>)>)

Returns the name of the property referenced by a closure-style lambda — useful when you already have an instance in scope and want a refactor-safe property name string instead of a magic literal.

Namespace:  AdvantageCMS.Core.Admin.BaseClasses
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


protected static string GetPropertyName<T>(
	Expression<Func<T>> propertyExpression
)

Type Parameters

T
Property value type, inferred by the compiler from propertyExpression.

Parameters

propertyExpression
Type: Expression<(Of <(<'Func<(Of <(<'T>)>)>>)>)>
A no-arg lambda whose body is a direct property access (for example () => instance.SomeProperty).

Return Value

The property's name as a string.

Examples


C#
var cfg = new AgentConfig { Name = "Concierge" };
string propName = GetPropertyName(() => cfg.Name);
// propName == "Name"

// Common use: pass a refactor-safe column name into AddSummaryDataRow
AddSummaryDataRow(GetPropertyName(() => cfg.Name), cfg.Name);