当前位置: 首页>>代码示例>>C#>>正文


C# TypeBuilder.GetField方法代码示例

本文整理汇总了C#中System.Reflection.Emit.TypeBuilder.GetField方法的典型用法代码示例。如果您正苦于以下问题:C# TypeBuilder.GetField方法的具体用法?C# TypeBuilder.GetField怎么用?C# TypeBuilder.GetField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Emit.TypeBuilder的用法示例。


在下文中一共展示了TypeBuilder.GetField方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateMSIL

        public override void GenerateMSIL(ILGenerator ilGenerator, TypeBuilder typeBuilder)
        {
            //a[i] = value
            FieldInfo fb = typeBuilder.GetField(RecordExpression.ExpressionID);

            ilGenerator.Emit(OpCodes.Ldsfld, fb);

            PropertyExpression.GenerateMSIL(ilGenerator, typeBuilder);

            RightHandExpression.GenerateMSIL(ilGenerator, typeBuilder);

            ilGenerator.Emit(OpCodes.Stelem_I4);
        }
开发者ID:nhannhan159,项目名称:PAT,代码行数:13,代码来源:PropertyAssignment.cs

示例2: GenerateMSIL

        public override void GenerateMSIL(ILGenerator ilGenerator, TypeBuilder typeBuilder)
        {
            FieldInfo fb = typeBuilder.GetField(Variable.ExpressionID);
            ilGenerator.Emit(OpCodes.Ldsfld, fb);

            foreach (var argument in Arguments)
            {
                argument.GenerateMSIL(ilGenerator, typeBuilder);
            }

            Type type = fb.GetType();

            ilGenerator.Emit(OpCodes.Callvirt, type.GetMethod(MethodName));
        }
开发者ID:nhannhan159,项目名称:PAT,代码行数:14,代码来源:ClassMethodCallInstance.cs

示例3: GenerateMSIL

        public override void GenerateMSIL(ILGenerator ilGenerator, TypeBuilder typeBuilder)
        {
            RightHandSide.GenerateMSIL(ilGenerator, typeBuilder);

            FieldInfo fb = typeBuilder.GetField(LeftHandSide);
            ilGenerator.Emit(OpCodes.Stsfld, fb);
        }
开发者ID:nhannhan159,项目名称:PAT,代码行数:7,代码来源:Assignment.cs

示例4: GenerateMSIL

 public override void GenerateMSIL(ILGenerator ilGenerator, TypeBuilder typeBuilder)
 {
     FieldInfo fb = typeBuilder.GetField(ExpressionID);
     ilGenerator.Emit(OpCodes.Ldsfld, fb);
 }
开发者ID:nhannhan159,项目名称:PAT,代码行数:5,代码来源:Variable.cs

示例5: GenerateMSIL


//.........这里部分代码省略.........
        //            CUDD.Ref(valueBddEncoding.ExpressionDDs[j], expressionDD);
        //            CUDDNode assignmentDD = CUDD.Function.Equal(valueBddEncoding.ExpressionDDs[j], expressionDD);
        //            guardDD = CUDD.Function.And(guardDD, assignmentDD);
        //            result.AddNodeToGuard(guardDD);
        //        }
        //        CUDD.Deref(expressionDD);
        //    }
        //    //remove unused expression
        //    variableBddEncoding.DeRef();
        //    valueBddEncoding.DeRef();
        //    return result;
        //}
        ///// <summary>
        ///// [ REFS: 'result', DEREFS: 'resultBefore' ]
        ///// </summary>
        //public override ExpressionBDDEncoding TranslateStatementToBDD(ExpressionBDDEncoding resultBefore, Model model)
        //{
        //    ExpressionBDDEncoding newUpdate = this.TranslateExpressionToBDD(model);
        //    ExpressionBDDEncoding tempResult = new ExpressionBDDEncoding();
        //    List<List<int>> updatedVariablesInNewUpdate = new List<List<int>>();
        //    for (int index = 0; index < newUpdate.Count(); index++)
        //    {
        //        updatedVariablesInNewUpdate.Add(model.GetColSupportedVars(newUpdate.GuardDDs[index]));
        //    }
        //    List<List<int>> usedVariableInNewUpdate = new List<List<int>>();
        //    for (int index = 0; index < newUpdate.Count(); index++)
        //    {
        //        usedVariableInNewUpdate.Add(model.GetRowSupportedVars(newUpdate.GuardDDs[index]));
        //    }
        //    List<List<int>> updatedVariablesBefore = new List<List<int>>();
        //    for (int index = 0; index < resultBefore.Count(); index++)
        //    {
        //        updatedVariablesBefore.Add(model.GetColSupportedVars(resultBefore.GuardDDs[index]));
        //    }
        //    for (int j1 = 0; j1 < resultBefore.Count(); j1++)
        //    {
        //        for (int j2 = 0; j2 < newUpdate.Count(); j2++)
        //        {
        //            //a variable is already updated, now is updated again and it also apprears in the value expression
        //            if (Assignment.IsComplexUpdate(updatedVariablesBefore[j1], updatedVariablesInNewUpdate[j2], usedVariableInNewUpdate[j2]))
        //            {
        //                model.CreateTemporaryVar();
        //                Expression newUpdate1;
        //                Expression newUpdate2;
        //                PropertyAssignment assignment = this as PropertyAssignment;
        //                newUpdate1 = new Assignment(Model.TEMPORARY_VARIABLE, this.RightHandExpression);
        //                newUpdate2 = new PropertyAssignment(this.RecordExpression, this.PropertyExpression, new Variable(Model.TEMPORARY_VARIABLE));
        //                resultBefore.Ref();
        //                ExpressionBDDEncoding tempResult1 = newUpdate1.TranslateStatementToBDD(resultBefore, model);
        //                ExpressionBDDEncoding tempResult2 = newUpdate2.TranslateStatementToBDD(tempResult1, model);
        //                //Remove the temporary variable from transition
        //                for (int i = 0; i < tempResult2.Count(); i++)
        //                {
        //                    tempResult2.GuardDDs[i] = CUDD.Abstract.ThereExists(tempResult2.GuardDDs[i], model.GetRowVars(model.GetVarIndex(Model.TEMPORARY_VARIABLE)));
        //                    tempResult2.GuardDDs[i] = CUDD.Abstract.ThereExists(tempResult2.GuardDDs[i], model.GetColVars(model.GetVarIndex(Model.TEMPORARY_VARIABLE)));
        //                    tempResult.AddNodeToGuard(tempResult2.GuardDDs[i]);
        //                }
        //            }
        //            else
        //            {
        //                //swap row, col updated variable in result in the new update command expression
        //                CUDDNode update2 = newUpdate.GuardDDs[j2];
        //                CUDD.Ref(update2);
        //                foreach (int index in updatedVariablesBefore[j1])
        //                {
        //                    if (usedVariableInNewUpdate[j2].Contains(index))
        //                    {
        //                        update2 = CUDD.Variable.SwapVariables(update2, model.GetColVars(index), model.GetRowVars(index));
        //                    }
        //                }
        //                //Restrict updated variable in new update of the old update
        //                CUDDNode update1 = resultBefore.GuardDDs[j1];
        //                CUDD.Ref(update1);
        //                foreach (int index in updatedVariablesInNewUpdate[j2])
        //                {
        //                    if (updatedVariablesBefore[j1].Contains(index))
        //                    {
        //                        update1 = CUDD.Abstract.ThereExists(update1, model.GetColVars(index));
        //                    }
        //                }
        //                CUDDNode transition = CUDD.Function.And(update1, update2);
        //                tempResult.AddNodeToGuard(transition);
        //            }
        //        }
        //    }
        //    resultBefore.DeRef();
        //    newUpdate.DeRef();
        //    return tempResult;
        //}
        public override void GenerateMSIL(ILGenerator ilGenerator, TypeBuilder typeBuilder)
        {
            FieldInfo fb = typeBuilder.GetField(ClassProperty.Variable.ExpressionID);
            ilGenerator.Emit(OpCodes.Ldsfld, fb);

            RightHandExpression.GenerateMSIL(ilGenerator, typeBuilder);

            Type type = fb.GetType();
            FieldInfo property = typeBuilder.GetField(ClassProperty.PropertyName);
            ilGenerator.Emit(OpCodes.Stsfld, property);
        }
开发者ID:nhannhan159,项目名称:PAT,代码行数:101,代码来源:ClassPropertyAssignment.cs


注:本文中的System.Reflection.Emit.TypeBuilder.GetField方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。