Table of Contents

Class TypeFactory

Namespace
ToSic.Sys.Utils.Types
Assembly
ToSic.Sys.Utils.dll

Special helper to create objects from a type.

[InternalApi_DoNotUse_MayChangeWithoutNotice]
public static class TypeFactory
Inheritance
object
TypeFactory

Remarks

The type must have a parameterless constructor, otherwise it will throw an error.

Methods

CreateInstance(Type)

public static object CreateInstance(Type type)

Parameters

type Type

Returns

object

CreateInstance<T>()

The Generic Wrapper: Uses the central cache but returns the correct type.

public static T CreateInstance<T>() where T : class

Returns

T

Type Parameters

T