|
| Dictionary< string, Func< T > > | dict = new Dictionary<string, Func<T>>() |
| |
Definition at line 6 of file ClassCache.cs.
◆ Create< T >()
| static T ClassCache< T >.Create< T > |
( |
string |
id, |
|
|
string |
assembly = "Assembly-CSharp" |
|
) |
| |
|
inlinestatic |
◆ Create< T2 >()
| T ClassCache< T >.Create< T2 > |
( |
string |
id, |
|
|
string |
assembly |
|
) |
| |
|
inline |
Definition at line 25 of file ClassCache.cs.
26 {
27 id = id.Trim();
28 Func<T> func =
dict.TryGetValue(
id);
29 if (func != null)
30 {
31 return func();
32 }
33 Type type = Type.GetType(id + ", " + assembly);
34 if (type == null)
35 {
37 {
39 if (type != null)
40 {
41 break;
42 }
43 }
44 }
47 return func();
48 }
Func< T > CreateDelegate(Type type)
static List< Func< string, Type > > typeLoaders
Dictionary< string, Func< T > > dict
References ClassCache< T >.CreateDelegate(), ClassCache< T >.dict, and ClassCache< T >.typeLoaders.
◆ CreateDelegate()
| Func< T > ClassCache< T >.CreateDelegate |
( |
Type |
type | ) |
|
|
inline |
Definition at line 10 of file ClassCache.cs.
11 {
12 Func<T> result = () => default(T);
13 if (type == null)
14 {
15 return result;
16 }
17 ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
18 if (constructor != null)
19 {
20 result = Expression.Lambda<Func<T>>(Expression.New(constructor), Array.Empty<ParameterExpression>()).Compile();
21 }
22 return result;
23 }
Referenced by ClassCache< T >.Create< T2 >().
◆ LoadTypeFromGlobalNamespace()
| static Type ClassCache< T >.LoadTypeFromGlobalNamespace |
( |
string |
id | ) |
|
|
inlinestatic |
Definition at line 65 of file ClassCache.cs.
66 {
68 {
69 Type type = Type.GetType(id + ", " + assembly);
70 if (type != null)
71 {
72 return type;
73 }
74 }
75 return null;
76 }
static HashSet< string > assemblies
References ClassCache< T >.assemblies.
◆ assemblies
| HashSet<string> ClassCache< T >.assemblies = new HashSet<string>() |
|
static |
◆ caches
◆ dict
| Dictionary<string, Func<T> > ClassCache< T >.dict = new Dictionary<string, Func<T>>() |
◆ modTypes
| HashSet<Type> ClassCache< T >.modTypes = new HashSet<Type>() |
|
static |
◆ typeLoaders
The documentation for this class was generated from the following file: