protected override void Start()
        {
            Log.L("Let's Allocate an instance");

            MyObject _object = MyObject.Allocate <MyObject>(EnvironmentType.Ev0);

            Log.L($" the instance id is  {_object.guid}");

            Log.L("Let's Recyle the instance");

            _object.Recyle();

            Log.L("Let's Allocate an instance   again");

            _object = MyObject.Allocate <MyObject>(EnvironmentType.Ev0);
            Log.L($" the instance id is  {_object.guid}");
        }
예제 #2
0
        protected override void Start()
        {
            Log.L("");
            Log.L("使用Allocate方法分配一个实例");
            MyObject _object = MyObject.Allocate <MyObject>(EnvironmentType.Ev0);

            Log.L($"当前实例的GUID为 {_object.guid}");
            _object.PrintValue();
            Log.L("将这个实例回收掉");

            _object.Recyle();

            Log.L("重新获取一个新的");

            _object = MyObject.Allocate <MyObject>(EnvironmentType.Ev0);
            Log.L($"当前实例的GUID为 {_object.guid}");
            Log.L("可以发现GUID是一样的,获取的是同一个实例");
        }