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


C# IReadOnlyDictionary类代码示例

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


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

示例1: Preset

 public Preset(IEnumerable<KeyValuePair<string, string>> names, IReadOnlyDictionary<string,object> properties)
 {
     foreach (var lang in names)
         PresetName[lang.Key] = lang.Value;
     foreach (var prop in properties)
         State[prop.Key] = prop.Value;
 }
开发者ID:dotMorten,项目名称:AllJoynLightingController,代码行数:7,代码来源:ControllerService.PresetService.cs

示例2: PipelineArgument

 /// <summary>
 /// Initializes a new instance of the <see cref="PipelineArgument"/> class.
 /// </summary>
 public PipelineArgument(IReadOnlyDictionary<string, string> propertyBag, IDocument document, IRuleSet rules, IPipelineMember successor)
 {
     PropertyBag = propertyBag;
     Document = document;
     Rules = rules;
     Successor = successor;
 }
开发者ID:tuvoksg1,项目名称:RulesEngine,代码行数:10,代码来源:PipelineArguments.cs

示例3: GetContent

        public override ContentItem GetContent(IReadOnlyDictionary<string, Argument> invocation, bool throwExceptionIfNotFound)
        {
            var uri = invocation["url"].AsUri();
            var request = WebRequest.Create(uri);
            request.UseDefaultCredentials = true;

            var response = this.GetResponse(uri.AbsoluteUri, request);

            var result = new ContentItem { ContentType = response.ContentType };

            using (var stream = response.GetResponseStream())
            {
                if (stream == Stream.Null || stream == null)
                {
                    if (throwExceptionIfNotFound)
                    {
                        throw new StoreItemNotFoundException(this.Name, uri.AbsoluteUri);
                    }

                    return null;
                }

                using (var reader = new StreamReader(stream))
                {
                    result.Content = reader.ReadToEnd();
                }
            }

            return result;
        }
开发者ID:niaher,项目名称:pipelyne,代码行数:30,代码来源:UrlStore.cs

示例4: RedisEntity

 public RedisEntity(RedisAccount account, BindingTemplate channelOrKeyPath, Mode mode, IReadOnlyDictionary<string, object> bindingData)
 {
     Account = account;
     Mode = mode;
     _channelOrKeyPath = channelOrKeyPath;
     _bindingData = bindingData;
 }
开发者ID:JasonHaley,项目名称:Redis.WebJobs.Extensions,代码行数:7,代码来源:RedisEntity.cs

示例5: PossiblyConvertBody

        static object PossiblyConvertBody(object messageBody, IReadOnlyDictionary<string, string> headers)
        {
            var legacySubscriptionMessage = messageBody as LegacySubscriptionMessage;

            if (legacySubscriptionMessage == null)
            {
                return messageBody;
            }

            string returnAddress;
            var topic = legacySubscriptionMessage.Type;

            if (!headers.TryGetValue(Headers.ReturnAddress, out returnAddress))
            {
                throw new RebusApplicationException($"Got legacy subscription message but the '{Headers.ReturnAddress}' header was not present on it!");
            }

            var subscribe = legacySubscriptionMessage.Action == 0;

            if (subscribe)
            {
                return new SubscribeRequest
                {
                    Topic = topic,
                    SubscriberAddress = returnAddress
                };
            }

            return new UnsubscribeRequest
            {
                Topic = topic,
                SubscriberAddress = returnAddress
            };
        }
开发者ID:RichieYang,项目名称:Rebus,代码行数:34,代码来源:UnpackLegacyMessageIncomingStep.cs

示例6: Activate

        public async override Task Activate(INavigationService navigationService, NavigationContextBase navigationContext, IReadOnlyDictionary<string, object> pageState)
        {
            await base.Activate(navigationService, navigationContext, pageState);

            MyNavigationContext context = navigationContext as MyNavigationContext;
            if (pageState != null)
            {
                /*********************************************************
                 * If you store state on deactivation and it is provided
                 * here, you know that the user has used the back button
                 * or returned from app suspension and should restore state.
                 *********************************************************/
                this.Value1 = pageState[nameof(this.Value1)] as string;
                this.Value2 = pageState[nameof(this.Value2)] as string;
                this.Value3 = pageState[nameof(this.Value3)] as string;
            }
            else if (context != null)
            {
                /*********************************************************
                 * Alternatively, if the user has navigated to the page
                 * for the first time, there won't be existing page state
                 * to restore. The context can be used to populate the page.
                 *********************************************************/
                this.Value1 = context.Value1;
                this.Value2 = context.Value2;
                this.Value3 = context.Value3;
            }
        }
开发者ID:colincwilliams,项目名称:CSharp-Navigation-Service,代码行数:28,代码来源:MainPageViewModel.cs

示例7: BindAddChild

 public override PropertyTreeMetaObject BindAddChild(OperatorDefinition definition, IReadOnlyDictionary<string, PropertyTreeMetaObject> arguments)
 {
     var result = definition.Apply(null, component, arguments);
     if (result == null)
         return Null;
     return CreateChild(result);
 }
开发者ID:Carbonfrost,项目名称:ff-property-trees,代码行数:7,代码来源:ReflectionMetaObject.cs

示例8: DownloadsScoreProvider

        public DownloadsScoreProvider(IndexReader reader,
            IReadOnlyDictionary<string, int[]> idMapping,
            Downloads downloads,
            RankingResult ranking,
            QueryBoostingContext context,
            double baseBoost)
            : base(reader)
        {
            _idMapping = idMapping;
            _downloads = downloads;
            _baseBoost = baseBoost;
            _ranking = ranking;
            _context = context;

            // We need the reader name: Lucene *may* have multiple segments (which are smaller indices)
            // and RankingsHandler provides us with the per-segment document numbers.
            //
            // If no segments are present (small index) we use an empty string, which is what
            // Lucene also uses internally.
            var segmentReader = reader as SegmentReader;

            _readerName = segmentReader != null
                ? segmentReader.SegmentName
                : string.Empty;
        }
开发者ID:NuGet,项目名称:NuGet.Services.Metadata,代码行数:25,代码来源:DownloadsScoreProvider.cs

示例9: CreateTableIfNotExists

        internal static string CreateTableIfNotExists(string tableName, CreateFlags createFlags, IReadOnlyDictionary<string, ColumnMapping> columns)
        {
            bool fts3 = (createFlags & CreateFlags.FullTextSearch3) != 0;
            bool fts4 = (createFlags & CreateFlags.FullTextSearch4) != 0;
            bool fts = fts3 || fts4;

            var @virtual = fts ? "VIRTUAL " : string.Empty;
            var @using = fts3 ? "USING FTS3 " : fts4 ? "USING FTS4 " : string.Empty;

            // Build query.
            var query = "CREATE " + @virtual + "TABLE IF NOT EXISTS \"" + tableName + "\" " + @using + "(\n";
            var decls = columns.Select(c => SQLBuilder.SqlDecl(c.Key, c.Value));
            var decl = string.Join(",\n", decls.ToArray());
            query += decl;
            var fkconstraints = 
                string.Join(
                    ",\n", 
                    columns.Where(x => x.Value.ForeignKeyConstraint != null).Select(x =>
                        string.Format("FOREIGN KEY(\"{0}\") REFERENCES \"{1}\"(\"{2}\")",
                             x.Key, 
                             x.Value.ForeignKeyConstraint.TableName,
                             x.Value.ForeignKeyConstraint.ColumnName)));
            query += (fkconstraints.Length != 0) ? "," + fkconstraints : "";
            query += ")";

            return query;
        }
开发者ID:matrostik,项目名称:SQLitePCL.pretty,代码行数:27,代码来源:SQLBuilder.cs

示例10: LanguageServiceMetadata

 public LanguageServiceMetadata(IDictionary<string, object> data)
     : base(data)
 {
     this.ServiceType = (string)data.GetValueOrDefault("ServiceType");
     this.Layer = (string)data.GetValueOrDefault("Layer");
     this.Data = (IReadOnlyDictionary<string, object>)data;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:7,代码来源:LanguageServiceMetadata.cs

示例11: CheckProperyType

        public static bool CheckProperyType(IReadOnlyDictionary<string, string> data, KeyValuePair<string, string> param)
        {
            var result = true;

            switch (param.Value)
            {
                case "Int32":
                    int number;
                    if (data.ContainsKey(param.Key))
                        result = int.TryParse(data[param.Key], out number);
                    break;
                case "Guid":
                    Guid guid;
                    if (data.ContainsKey(param.Key))
                        result = Guid.TryParse(data[param.Key], out guid);
                    break;
                case "DateTime":
                    DateTime dateTime;
                    if (data.ContainsKey(param.Key))
                        result = DateTime.TryParse(data[param.Key], out dateTime);
                    break;
            }

            return result;
        }
开发者ID:v-lukyanenko,项目名称:Crate.DataStorage,代码行数:25,代码来源:Tools.cs

示例12: Validate

 public Task Validate(ParsedMutation mutation, IReadOnlyList<SignatureEvidence> authentication, IReadOnlyDictionary<AccountKey, AccountStatus> accounts)
 {
     if (this.alwaysValid)
         return Task.FromResult(0);
     else
         throw new TransactionInvalidException("Disabled");
 }
开发者ID:hellwolf,项目名称:openchain,代码行数:7,代码来源:NullValidator.cs

示例13: SetApplicationData

 public void SetApplicationData(IReadOnlyDictionary<string, object> applicationData) {
     // creating fake context is the only way to access HttpApplicationFactory.ApplicationState
     var context = new HttpContext(new SimpleWorkerRequest("", "", new StringWriter()));
     foreach (var pair in applicationData) {
         context.Application[pair.Key] = pair.Value;
     }
 }
开发者ID:nwillems,项目名称:Gate.Adapters.AspNet,代码行数:7,代码来源:AspNetRemote.cs

示例14: NpkDirDifferences

 public NpkDirDifferences(IReadOnlyList<ImgInfo> imgsInFirstButNotSecond, IReadOnlyDictionary<NpkPath, FrameCountDifferenceInfo> imgsWithFewerFramesInSecond, IReadOnlyList<ImgInfo> imgsInSecondButNotFirst, IReadOnlyDictionary<NpkPath, FrameCountDifferenceInfo> imgsWithMoreFramesInSecond)
 {
     ImgsInFirstButNotSecond = imgsInFirstButNotSecond;
     ImgsWithFewerFramesInSecond = imgsWithFewerFramesInSecond;
     ImgsInSecondButNotFirst = imgsInSecondButNotFirst;
     ImgsWithMoreFramesInSecond = imgsWithMoreFramesInSecond;
 }
开发者ID:TeoTwawki,项目名称:DFOToolBox,代码行数:7,代码来源:NpkDirDifferences.cs

示例15: RootGuardianActorRef

 public RootGuardianActorRef(ActorSystemImpl system, Props props, MessageDispatcher dispatcher, Func<Mailbox> createMailbox, //TODO: switch from  Func<Mailbox> createMailbox to MailboxType mailboxType
     IInternalActorRef supervisor, ActorPath path, IInternalActorRef deadLetters, IReadOnlyDictionary<string, IInternalActorRef> extraNames)
     : base(system,props,dispatcher,createMailbox,supervisor,path)
 {
     _deadLetters = deadLetters;
     _extraNames = extraNames;
 }
开发者ID:yaozd,项目名称:akka.net,代码行数:7,代码来源:RootGuardianActorRef.cs


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