예제 #1
0
        public override IValue CreateValueFromRuntime(object obj, CilManagedMemory managedMemory, CilProgram program)
        {
            var cilObj = new CilObjectExternal(obj);
            var objRef = managedMemory.Store(cilObj);

            return(objRef);
        }
예제 #2
0
        public override IValue CreateValueFromRuntime(object obj, CilManagedMemory managedMemory, CilProgram program)
        {
            if (program.IsExternalType(ClassName))
            {
                var cilObj = new CilObjectExternal(obj);
                var objRef = managedMemory.Store(cilObj);
                return(objRef);
            }

            throw new NotImplementedException();
        }
예제 #3
0
        public override IValue CreateValueFromRuntime(object obj, CilManagedMemory managedMemory, CilProgram program)
        {
            var runtimeArr = obj as Array;

            if (Dimensions == 1)
            {
                var resultArray = new IValue[runtimeArr.Length];
                for (int i = 0; i < runtimeArr.Length; i++)
                {
                    resultArray[i] = ElementType.CreateValueFromRuntime(runtimeArr.GetValue(i), managedMemory, program);
                }

                var cilArray = new CilArray(resultArray, ElementType);
                var arrayRef = managedMemory.Store(cilArray);
                return(arrayRef);
            }

            var extObj = new CilObjectExternal(obj);
            var objRef = managedMemory.Store(extObj);

            return(objRef);
        }