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


C# Scope.Add方法代码示例

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


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

示例1: BaseSessionManager

        public BaseSessionManager(string sessionId, SimplTypesScope translationScope, Scope<object> applicationObjectScope, ServerProcessor frontend)
        {
            FrontEnd = frontend;
            SessionId = sessionId;
            TranslationScope = translationScope;

            LocalScope = GenerateContextScope(applicationObjectScope);
            LocalScope.Add(SessionObjects.SessionId, sessionId);
            LocalScope.Add(SessionObjects.ClientManager, this);
        }
开发者ID:ecologylab,项目名称:simplCSharp,代码行数:10,代码来源:BaseSessionManager.cs

示例2: NativeCallContext

        public NativeCallContext(NativeMethod source, IElfObject @this, params IElfObject[] args) 
        {
            Stack = new Stack<IElfObject>();

            var callScope = new Scope();
            callScope.Add("@this", @this);
            source.FuncDef.Args.Zip(args, callScope.Add);
            Scopes = new Stack<Scope>();
            Scopes.Push(callScope);

            Source = source;
            if (source.FuncDef.Args.Count() != args.Length)
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}({1})' with args '{2}'. Reason: args count mismatch.",
                   Source.Name, Source.FuncDef.Args.StringJoin(), args.StringJoin()));
            }

            CurrentEvi = 0;
            PrevEvi = -1;
            if (source.Body.IsNullOrEmpty())
            {
                throw new UnexpectedElfRuntimeException(@this.VM, String.Format(
                   "Fatal error invoking native call '{0}'. Reason: empty method body.", Source.Name));
            } 
        }
开发者ID:xeno-by,项目名称:elf4b,代码行数:26,代码来源:NativeCallContext.cs

示例3: ChatClient

 public ChatClient()
 {
     chatTranslation = ChatTranslations.Get();
     clientScope = new Scope<object>();
     clientScope.Add(ChatConstants.ChatUpdateLisener, this);
     _client = new WebSocketOODSSClient(ServerAddress, PortNumber, chatTranslation, clientScope);
 }
开发者ID:ecologylab,项目名称:WebSocketOODSSTutorial,代码行数:7,代码来源:ChatClient.cs

示例4: WebSocketOODSSServer

        /// <summary>
        /// Initialize a websocket oodss server object
        /// </summary>
        /// <param name="serverTranslationScope">translationscope for the oodss messages</param>
        /// <param name="applicationObjectScope">server object scope</param>
        /// <param name="idleConnectionTimeout"></param>
        /// <param name="maxMessageSize"></param>
        public WebSocketOODSSServer(SimplTypesScope serverTranslationScope, Scope<object> applicationObjectScope,
			int idleConnectionTimeout=-1, int maxMessageSize=-1, int port=0)
            : base(port, Dns.GetHostAddresses(Dns.GetHostName()), serverTranslationScope, applicationObjectScope, 
            idleConnectionTimeout, maxMessageSize)
        {
            MaxMessageSize = maxMessageSize + NetworkConstants.MaxHttpHeaderLength;
            TranslationScope = serverTranslationScope;

            ApplicationObjectScope = applicationObjectScope;

            ApplicationObjectScope.Add(SessionObjects.SessionsMap, ClientSessionManagerMap);
            ApplicationObjectScope.Add(SessionObjects.WebSocketOODSSServer, this);

            _serverInstance = this;

            SetUpWebSocketServer(port);
        }
开发者ID:ecologylab,项目名称:simplCSharp,代码行数:24,代码来源:WebSocketOODSSServer.cs

示例5: TestServiceClient

 public TestServiceClient(string serviceAddress, int port)
 {
     _serviceAddress = serviceAddress;
     _port = port;
     _testTypesScope = TestClientTypesScope.Get();
     _clientScope = new Scope<object>();
     _clientScope.Add(TestServiceConstants.ServiceUpdateListener, this);
     _client = new WebSocketOODSSClient(_serviceAddress, _port, _testTypesScope, _clientScope);
 }
开发者ID:ecologylab,项目名称:simplCSharp,代码行数:9,代码来源:TestServiceClient.cs

示例6: DoSemanticChecks

        public override void DoSemanticChecks(ErrorHandler errs, Scope currentScope)
        {
            _scope = new Scope(currentScope, this);

            // Add foreach loop iterator variable to the scope
            if (!string.IsNullOrEmpty(_iterator))
            {
                _scope.Add(new NVLocalNode(_iterator, null));
            }

            foreach (AstNode astNode in _content)
            {
                astNode.DoSemanticChecks(errs, _scope);
            }
        }
开发者ID:jonorossi,项目名称:cvsi,代码行数:15,代码来源:NVForeachDirective.cs

示例7: Wrap

        public override void Wrap(Scope scope)
        {
            base.Wrap(scope);

            // now we need to add default columns if necessary
            if (Columns.Count == 0)
                AddDefaultColumns(scope);

            // next we need to remove child extents of the select from scope
            if (Name != null)
            {
                scope.Remove(this);
                scope.Add(Name, this);
            }
        }
开发者ID:noahvans,项目名称:mariadb-connector-net,代码行数:15,代码来源:SelectStatement.cs

示例8: AddIdentsToScope

        public void AddIdentsToScope(ErrorHandler errs, Scope currentScope)
        {
            _scope = new Scope(currentScope, this);

            foreach (NVMethodNode methodNode in _methods)
            {
                if (_scope.Exists(methodNode.Name))
                {
                    AddSemanticError(errs, string.Format("Type '{0}' already defines a member called {1}", _name, methodNode.Name),
                        methodNode.Position, ErrorSeverity.Error);
                }
                else
                {
                    _scope.Add(methodNode);
                }
            }
        }
开发者ID:jonorossi,项目名称:cvsi,代码行数:17,代码来源:NVClassNode.cs

示例9: WebSocketOODSSClient

        // background working thread

        #endregion WebSocketComponent

        #region Constructor

        /// <summary>
        /// Initialze a websocket OODSS client object
        /// </summary>
        /// <param name="ipAddress">server's ip address</param>
        /// <param name="portNumber">server's port number</param>
        /// <param name="translationScope">TranslationScope for OODSS messages</param>
        /// <param name="objectRegistry">application object scope</param>
        public WebSocketOODSSClient(String ipAddress, int portNumber, SimplTypesScope translationScope,
                                    Scope<object> objectRegistry)
        {
            ObjectRegistry = objectRegistry;
            TranslationScope = translationScope;
            ObjectRegistry.Add(SessionObjects.SessionId, _sessionId);
            ServerAddress = ipAddress;
            PortNumber = portNumber;


            _pendingRequests = new ConcurrentDictionary<long, RequestQueueObject>();
            _requestQueue = new BlockingCollection<RequestQueueObject>(new ConcurrentQueue<RequestQueueObject>());
            _responseQueue = new BlockingCollection<ResponseQueueObject>(new ConcurrentQueue<ResponseQueueObject>());


        }
开发者ID:ecologylab,项目名称:simplCSharp,代码行数:29,代码来源:WebSocketOODSSClient.cs

示例10: UpdateMapWithEntry

        /// <summary>
        /// 
        /// </summary>
        /// <param name="newMap"></param>
        /// <param name="key"></param>
        /// <param name="translationEntry"></param>
        /// <param name="warn"></param>
        private void UpdateMapWithEntry(Scope<ClassDescriptor> newMap, string key, ClassDescriptor translationEntry, string warn)
        {
            ClassDescriptor existingEntry = null;

            Boolean entryExists = newMap.TryGetValue(key, out existingEntry);
            Boolean newEntry = !entryExists ? true : existingEntry.DescribedClass != translationEntry.DescribedClass;

            if (newEntry)
            {
                if (entryExists)
                    Debug.WriteLine("Overriding " + warn + " " + key + " with " + translationEntry);

                newMap.Add(key, translationEntry);
            }
        }
开发者ID:ecologylab,项目名称:simplCSharp,代码行数:22,代码来源:SimplTypesScope.cs

示例11: CompileAssign

        public static Expression CompileAssign(Assign node, Scope scope)
        {
            var variable = node.Variable as Value;
            var value = node.Value;

            if (variable != null)
            {
                if (variable.IsObject)
                {
                    var obj = variable.Base as Obj;
                    return CompileObjectAssignment(obj, value, scope);
                }

                if (!node.Variable.IsAssignable)
                    throw new InvalidOperationException("Variable is not assignable");
                if (!variable.HasProperties)
                {
                    foreach(var name in CompileToNames(variable))
                        scope.Add(name, VariableType.Variable);
                }
            }

            var right = Compile(value, scope);

            return GetMemberInvocaton(node.Variable, scope,
                        (memberObject, name) => Expression.Dynamic(scope.GetRuntime().SetMemberBinders.Get(name), typeof (object), memberObject, right),
                        (memberObject) => Expression.Assign(memberObject, right));
        }
开发者ID:kthompson,项目名称:CoffeeScript,代码行数:28,代码来源:ExpressionCompiler.cs

示例12: Push

        public void Push(JObject doc)
        {
            Scope currentScope = new Scope();

            JToken t;
            if (doc.TryGetValue("@context", out t))
            {
                JObject context = (JObject)t;
                foreach (JProperty prop in context.Properties())
                {
                    if (prop.Value.Type == JTokenType.Object)
                    {
                        currentScope.Add(prop.Name, new TermDefinition((JObject)prop.Value));
                    }
                    else
                    {
                        string value = prop.Value.ToString();

                        switch (prop.Name)
                        {
                            case "@base":
                                currentScope.Base = value;
                                break;
                            case "@vocab":
                                currentScope.Vocab = value;
                                break;
                            case "@language":
                                currentScope.Language = value;
                                break;
                            default:
                                switch (value)
                                {
                                    case "@id":
                                    case "@type":
                                        //TODO: other keywords
                                        currentScope.AddAlias(prop.Name, value);
                                        break;
                                    default:
                                        currentScope.Add(prop.Name, new TermDefinition(value));
                                        break;
                                }
                                break;
                        }
                    }
                }

                currentScope.Expand(this);
            }

            _context.Push(currentScope);
        }
开发者ID:johnataylor,项目名称:JLD,代码行数:51,代码来源:JsonLdProcessorContext.cs


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