Class NamedFunction<T>
Stores a delegate by name for use with a value-providing interface (IBool, IString, ISprite). The function must be defined before the value property is accessed. To ensure compatibility with round-trip deserialization, it is advised to define the function from a Module or Tag's Load.
Inheritance
System.Object
NamedFunction<T>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: ItemChanger
Assembly: ItemChanger.dll
Syntax
public class NamedFunction<T>
Type Parameters
Name | Description |
---|---|
T |
Constructors
| Improve this Doc View SourceNamedFunction(String)
Declaration
public NamedFunction(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Properties
| Improve this Doc View SourceName
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
System.String |
Value
Declaration
public T Value { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceDefine(String, Func<T>)
Defines the named function, and returns a object which refers to it. Throws an exception if a function with the same name has already been defined.
Declaration
public static NamedFunction<T> Define(string name, Func<T> getter)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
Func<T> | getter |
Returns
Type | Description |
---|---|
NamedFunction<T> |
Redefine(String, Func<T>)
Defines the named function, and returns a object which refers to it. Overwrites any function with the same name which has already been defined.
Declaration
public static NamedFunction<T> Redefine(string name, Func<T> getter)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | |
Func<T> | getter |
Returns
Type | Description |
---|---|
NamedFunction<T> |