SharedValue
One setting value in a share code. Create one with the static factory for its kind; each kind is its own sealed subclass holding only its own data.
public abstract class SharedValue : IEquatable<SharedValue>Two values are equal when they have the same kind and the same bits, so NaN (not a number) equals NaN and -0 does not equal 0.
Inheritance: Object → SharedValue
Implements: IEquatable<SharedValue>
Derived: SharedBool · SharedInt · SharedFloat · SharedString · SharedEnumName · SharedEnumValue · SharedColor · SharedSerialized
Methods
Bool(Boolean)
public static SharedBool Bool(bool value)Creates a SharedBool value.
Int(Int32)
public static SharedInt Int(int value)Creates a SharedInt value.
Float(Single)
public static SharedFloat Float(float value)Creates a SharedFloat value.
String(String)
public static SharedString String(string value)Creates a SharedString value. value may be null.
EnumName(String)
public static SharedEnumName EnumName(string name)Creates a SharedEnumName value from an enum member name.
EnumValue(Int64)
public static SharedEnumValue EnumValue(long value)Creates a SharedEnumValue value from an enum's underlying number.
Color(Single, Single, Single, Single)
public static SharedColor Color(float r, float g, float b, float a)Creates a SharedColor value from RGBA channels, normally 0 to 1.
Serialized(String)
public static SharedSerialized Serialized(string text)Creates a SharedSerialized value: a mod-registered type's serialized text.
Equals(SharedValue)
public abstract bool Equals(SharedValue other);Indicates whether the current object is equal to another object of the same type.
Equals(Object)
public override bool Equals(object obj)Determines whether the specified object is equal to the current object.
GetHashCode()
public abstract override int GetHashCode();Serves as the default hash function.
ToString()
public abstract override string ToString();Returns the value as text, for display. Floats use the shortest round-trip form.
Operators
operator ==(SharedValue, SharedValue)
public static bool operator ==(SharedValue left, SharedValue right)Returns true if both values have the same kind and bits, or both are null.
operator !=(SharedValue, SharedValue)
public static bool operator !=(SharedValue left, SharedValue right)Returns true if the values differ in kind or bits.