继承自 SharedVariable 类,并实现必要方法,结构如下:
[System.Serializable]
public class SharedOBJECT_TYPE : SharedVariable<OBJECT_TYPE>
{
public static implicit operator SharedOBJECT_TYPE(OBJECT_TYPE value) { return new SharedOBJECT_TYPE { Value = value }; }
}
其中 OBJECT_TYPE 是数据类型。
真实的例子:
[System.Serializable]
public class CustomClass
{
public int myInt;
public Object myObject;
}
[System.Serializable]
public class SharedCustomClass : SharedVariable<CustomClass>
{
public static implicit operator SharedCustomClass(CustomClass value) { return new SharedCustomClass { Value = value }; }
}