MethodAccessorInvoke(Object) Method

Invokes the method with no parameters. The return value of void methods is always . For static methods the instance parameter is omitted (can be ).
See the Remarks section of the Invoke(Object, Object) overload for details.

Definition

Namespace: KGySoft.Reflection
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public Object? Invoke(
	Object? instance
)

Parameters

instance  Object
The instance that the method belongs to. Can be for static methods.

Return Value

Object
The return value of the method, or for void methods.

Exceptions

ArgumentNullExceptionThis MethodAccessor represents an instance method and instance is .
ArgumentExceptionThe type of instance is invalid.
-or-
The method expects parameters.
InvalidOperationExceptionThis MethodAccessor represents an open generic method or a method of an open generic type.
NotSupportedExceptionOn .NET Framework the code is executed in a partially trusted domain with insufficient permissions.
PlatformNotSupportedExceptionYou use the .NET Standard 2.0 build of KGySoft.CoreLibraries and this MethodAccessor represents a ref-returning method.

See Also