ToMemberInfo()
Gets a MemberInfo that represents the current member or type at run time.
Declaration
MemberInfo ToMemberInfo()Returns
| Type | Description |
|---|---|
| MemberInfo | A MemberInfo that can be used only in run-time code. |
Remarks
This method generates run-time code that retrieves the MemberInfo object for the current declaration. The actual return type depends on the declaration: FieldInfo for fields, PropertyInfo for properties, MethodInfo for methods, and so on.
While Metalama is designed to eliminate the need for reflection in most scenarios, this method is useful when you need to pass member metadata to APIs that require MemberInfo objects.
Warning: The code generated by this method relies on member names and may break if your project is obfuscated. Consider using strongly-typed alternatives when possible.