继承自 SharedVariable 类,并实现必要方法,结构如下:

    1. [System.Serializable]
    2. public class SharedOBJECT_TYPE : SharedVariable<OBJECT_TYPE>
    3. {
    4. public static implicit operator SharedOBJECT_TYPE(OBJECT_TYPE value) { return new SharedOBJECT_TYPE { Value = value }; }
    5. }

    其中 OBJECT_TYPE 是数据类型。

    真实的例子:

    1. [System.Serializable]
    2. public class CustomClass
    3. {
    4. public int myInt;
    5. public Object myObject;
    6. }
    7. [System.Serializable]
    8. public class SharedCustomClass : SharedVariable<CustomClass>
    9. {
    10. public static implicit operator SharedCustomClass(CustomClass value) { return new SharedCustomClass { Value = value }; }
    11. }