Open sandboxFocus

Method ToPropertyInfo

ToPropertyInfo()

Gets a PropertyInfo that represents the current property or indexer at run time.

Declaration
PropertyInfo ToPropertyInfo()
Returns
Type Description
PropertyInfo

A PropertyInfo that can be used only in run-time code.

Remarks

This method generates run-time code that retrieves the PropertyInfo object for the current property or indexer. While Metalama is designed to eliminate the need for reflection in most scenarios, this method is useful when you need to pass property metadata to APIs that require PropertyInfo objects.

Warning: The code generated by this method relies on property names and may break if your project is obfuscated. Consider using the Value property to access property values directly when possible, as this approach is obfuscation-safe.

See Also