Open sandboxFocus

Method ToType

ToType()

Gets a reflection Type that represents the current type at run time.

Declaration
Type ToType()
Returns
Type Description
Type

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

Remarks

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

Warning: The code generated by this method relies on type names and may break if your project is obfuscated. Consider using direct type references when possible to avoid obfuscation issues.

See Also