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


C# IDynamicMetaObjectProvider类代码示例

本文整理汇总了C#中IDynamicMetaObjectProvider的典型用法代码示例。如果您正苦于以下问题:C# IDynamicMetaObjectProvider类的具体用法?C# IDynamicMetaObjectProvider怎么用?C# IDynamicMetaObjectProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: SetMember

 internal static void SetMember(IDynamicMetaObjectProvider o, string name, object value)
 {
     CallSite<Action<CallSite, object, object>> site;
     if(!setSites.TryGetValue(name, out site)) {
         site = CallSite<Action<CallSite, object, object>>.Create(new DoHelpersSetMemberBinder(name));
         setSites.Add(name, site);
     }
     site.Target(site, o, value);
 }
开发者ID:Alxandr,项目名称:Totem-2.0,代码行数:9,代码来源:DynamicObjectHelpers.cs

示例2: IDOIndexSet

 internal static void IDOIndexSet(IDynamicMetaObjectProvider Instance, object[] Arguments, string[] ArgumentNames)
 {
     SaveCopyBack back = new SaveCopyBack(null);
     using (back)
     {
         object[] packedArgs = null;
         CallInfo callInfo = null;
         IDOUtils.PackArguments(1, ArgumentNames, Arguments, ref packedArgs, ref callInfo);
         IDOUtils.CreateFuncCallSiteAndInvoke(new VBIndexSetBinder(callInfo), Instance, packedArgs);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:IDOBinder.cs

示例3: TryGetMember

 internal bool TryGetMember(IDynamicMetaObjectProvider dynamicProvider, string name, out object value)
 {
     ValidationUtils.ArgumentNotNull(dynamicProvider, "dynamicProvider");
     var callSite = _callSiteGetters.Get(name);
     var result = callSite.Target(callSite, dynamicProvider);
     if (!ReferenceEquals(result, NoThrowExpressionVisitor.ErrorResult))
     {
         value = result;
         return true;
     }
     value = null;
     return false;
 }
开发者ID:sat1582,项目名称:CODEFramework,代码行数:13,代码来源:JsonDynamicContract.cs

示例4: ExecuteFileInScope

 // ExecuteFileInScope executes the file in the given module scope.  This
 // does NOT store the module scope on Globals.  This function returns
 // nothing.
 //
 public void ExecuteFileInScope(string filename,
                                IDynamicMetaObjectProvider moduleEO) {
     var f = new StreamReader(filename);
     // Simple way to convey script rundir for RuntimeHelpes.SymplImport
     // to load .sympl files.
     DynamicObjectHelpers.SetMember(moduleEO, "__file__", 
                                    Path.GetFullPath(filename));
     try {
         var moduleFun = ParseFileToLambda(filename, f);
         var d = moduleFun.Compile();
         d(this, moduleEO);
     } finally {
         f.Close();
     }
 }
开发者ID:TerabyteX,项目名称:main,代码行数:19,代码来源:Sympl.cs

示例5: ForwardingMetaObject

 public ForwardingMetaObject(
     Expression expression,
     BindingRestrictions restrictions,
     object forwarder,
     IDynamicMetaObjectProvider forwardee,
     Func<Expression, Expression> forwardeeGetter
     )
     : base(expression, restrictions, forwarder)
 {
     // We'll use forwardee's meta-object to bind dynamic operations.
     metaForwardee = forwardee.GetMetaObject(
         forwardeeGetter(
             Expression.Convert(expression, forwarder.GetType())   // [1]
         )
     );
 }
开发者ID:qujck,项目名称:MarkdownEditor,代码行数:16,代码来源:ForwardingMetaObject.cs

示例6: IDOGet

 internal static object IDOGet(IDynamicMetaObjectProvider Instance, string MemberName, object[] Arguments, string[] ArgumentNames, bool[] CopyBack)
 {
     object obj2;
     SaveCopyBack back = new SaveCopyBack(CopyBack);
     using (back)
     {
         object[] packedArgs = null;
         CallInfo callInfo = null;
         IDOUtils.PackArguments(0, ArgumentNames, Arguments, ref packedArgs, ref callInfo);
         try
         {
             return IDOUtils.CreateRefCallSiteAndInvoke(new VBGetBinder(MemberName, callInfo), Instance, packedArgs);
         }
         finally
         {
             IDOUtils.CopyBackArguments(callInfo, packedArgs, Arguments);
         }
     }
     return obj2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:IDOBinder.cs

示例7: ProtoTypalObjectWithMethods

 public ProtoTypalObjectWithMethods( IDynamicMetaObjectProvider prototype )
     : base(prototype)
 {
     StaticMethodWithNoReturnValueOrParametersWasCalled = false;
 }
开发者ID:larsw,项目名称:Archetype,代码行数:5,代码来源:ProtoTypalObjectWithMethods.cs

示例8: TheDude

 public TheDude( IDynamicMetaObjectProvider module )
     : base(module)
 {
 }
开发者ID:idavis,项目名称:Archetype,代码行数:4,代码来源:Person.cs

示例9: GetDynamicProperties

        private static PropertyReader[] GetDynamicProperties(IDynamicMetaObjectProvider provider)
        {
            var metaObject = provider.GetMetaObject(Expression.Constant(provider));

            var memberNames = metaObject.GetDynamicMemberNames(); // may return property names as well as method names, etc.

            var result = new List<PropertyReader>();

            foreach (var name in memberNames)
            {
                try
                {
                    var argumentInfo = new[] {CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)};

                    var binder = Binder.GetMember(CSharpBinderFlags.None, name, provider.GetType(), argumentInfo);

                    var site = CallSite<Func<CallSite, object, object>>.Create(binder);

                    var value = site.Target(site, provider); // will throw if no valid property getter

                    result.Add(new PropertyReader
                    {
                        Name = name,
                        DeclaringType = provider.GetType(),
                        Read = o => value
                    });
                }
                catch (RuntimeBinderException)
                {
                }
            }

            return result.ToArray();
        }
开发者ID:naraga,项目名称:DeepEqual,代码行数:34,代码来源:ReflectionCache.cs

示例10: Scope

 /// <summary>
 /// Creates a new scope which is backed by an arbitrary object for it's storage.
 /// </summary>
 /// <param name="storage"></param>
 public Scope(IDynamicMetaObjectProvider storage)
 {
     _extensions = ScopeExtension.EmptyArray;
     _storage = storage;
 }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:Scope.cs

示例11: CreateScope

 public ScriptScope CreateScope(string languageId, IDynamicMetaObjectProvider storage) {
     return GetEngine(languageId).CreateScope(storage);
 }
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:3,代码来源:ScriptRuntime.cs

示例12: HasPropertyNaive

        private static bool HasPropertyNaive(IDynamicMetaObjectProvider dynamicProvider, string name)
        {
            try
            {
                var callSite =
                                CallSite<Func<CallSite, object, object>>.Create(Binder.GetMember(CSharpBinderFlags.None, name, typeof(Program),
                                                         new[]
                                                                 {
                                                                     CSharpArgumentInfo.Create(
                                                                         CSharpArgumentInfoFlags.None, null)
                                                                 }));
                callSite.Target(callSite, dynamicProvider);
                return true;
            }
            catch (RuntimeBinderException)
            {

                return false;
            }
        }
开发者ID:renestein,项目名称:DynamicCheckPropertyExistence,代码行数:20,代码来源:Program.cs

示例13: ExecuteExpr

 // Execute a single expression parsed from string in the provided module
 // scope and returns the resulting value.
 //
 public object ExecuteExpr(string expr_str,
                           IDynamicMetaObjectProvider moduleEO) {
     var moduleFun = ParseExprToLambda(new StringReader(expr_str));
     var d = moduleFun.Compile();
     return d(this, moduleEO);
 }
开发者ID:TerabyteX,项目名称:main,代码行数:9,代码来源:Sympl.cs

示例14: CreateFromDynamicMetaObject

        private static TableItem CreateFromDynamicMetaObject( IDynamicMetaObjectProvider entity, bool throwOnReservedPropertyName )
        {
            var properties = new Dictionary<string, Tuple<object, Type>>();
             IEnumerable<string> memberNames = Dynamic.GetMemberNames( entity );
             foreach ( var memberName in memberNames )
             {
            dynamic result = Dynamic.InvokeGet( entity, memberName );
            properties[memberName] = new Tuple<object, Type>( (object) result, result.GetType() );
             }

             return new TableItem( properties, throwOnReservedPropertyName );
        }
开发者ID:TechSmith,项目名称:hyde,代码行数:12,代码来源:TableItem.cs

示例15: _OnStartExecute

        private void _OnStartExecute(IDynamicMetaObjectProvider executingScope, SourceUnit sourceUnit)
        {
            ContractUtils.Requires(executingScope is Scope);

            ExecutingScope = executingScope as Scope;
            ExecutingScopeStorage = ExecutingScope.Storage;

            //We should update the context under which this LuaTable is executing
            //so that it resolves metamethod overrides correctly.
            //TODO: Decide whether we should keep this if it is non-null, it may be that this is coming from a different
            //      CodeContext which has some metamethod stuff set particularly for this scope, or its contents, and we
            //      shouldn't change this.
            if (ExecutingScopeStorage is LuaTable)
                (ExecutingScopeStorage as LuaTable).Context = this;

            _LoadedPackages.Clear();
            _FunctionStacks.Clear();
            _EnvironmentMappings.Clear();   //We clear this here as opposed to in OnFinishExecute in case the last execution failed
        }
开发者ID:SPARTAN563,项目名称:IronLua,代码行数:19,代码来源:CodeContext.Expressions.cs


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