Open sandboxFocus

Method ToConstructorInfo

ToConstructorInfo()

Gets a ConstructorInfo that represents the current constructor at run time.

Declaration
ConstructorInfo ToConstructorInfo()
Returns
Type Description
ConstructorInfo

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

Remarks

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

Warning: The code generated by this method relies on constructor signatures and may break if your project is obfuscated. Consider using constructor invokers (such as Invoke(params dynamic?[])) when possible, as this approach is obfuscation-safe.

See Also