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


C# ReadOnlyDictionary类代码示例

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


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

示例1: Main

        public static void Main(string[] args)
        {
            Console.WriteLine("Hello llml!");

            var dict = new Dictionary<string, object>();
            IDictionary<string, object> roDict = new ReadOnlyDictionary<string, object>(dict);
        }
开发者ID:jagt,项目名称:llml,代码行数:7,代码来源:Program.cs

示例2: NodeDevice

        private NodeDevice(ReadOnlyDictionary<FieldIdentifier, FieldBase> Fields,
            ReadOnlyCollection<NodeBase> Children)
            : base(Fields, Children)
        {
            NodeDeviceChildren = new TypedChildCollection<NodeDevice, NodeDevice>(this);
            NodeDiscreteInputChildren = new TypedChildCollection<NodeDiscreteInput, NodeDevice>(this);
            NodeDiscreteOutputChildren = new TypedChildCollection<NodeDiscreteOutput, NodeDevice>(this);
            NodeAnalogInputChildren = new TypedChildCollection<NodeAnalogInput, NodeDevice>(this);
            NodeAnalogOutputChildren = new TypedChildCollection<NodeAnalogOutput, NodeDevice>(this);
            NodeStringInputChildren = new TypedChildCollection<NodeStringInput, NodeDevice>(this);
            NodeStringOutputChildren = new TypedChildCollection<NodeStringOutput, NodeDevice>(this);

            // Validation
            if (Code == null)
            {
                throw new ArgumentNullException(m_CodeName);
            }
            if (TypeId == null)
            {
                throw new ArgumentNullException(m_TypeIdName);
            }
            if (Address == null)
            {
                throw new ArgumentNullException(m_AddressName);
            }
            if (Configuration == null)
            {
                throw new ArgumentNullException(m_ConfigurationName);
            }
            if (DeviceName == null)
            {
                throw new ArgumentNullException(m_DeviceNameName);
            }
        }
开发者ID:EdWeller,项目名称:SoapboxSnap,代码行数:34,代码来源:NodeDevice.cs

示例3: ActionResult

        public ActionResult(string returnValue, IDictionary<string, string> outArguments)
        {
            if (outArguments == null) throw new ArgumentNullException ();

            return_value = returnValue;
            out_arguments = new ReadOnlyDictionary<string,string> (outArguments);
        }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:7,代码来源:ActionResult.cs

示例4: SunxiHighSpeedTimer

        public SunxiHighSpeedTimer(Machine machine, long frequency)
        {
            irqEnableRegister = new DoubleWordRegister(this);
            irqStatusRegister = new DoubleWordRegister(this);
            
            timers = new SunxiHighSpeedTimerUnit[4];
            interruptFlags = new IFlagRegisterField[4];
            enableFlags = new IFlagRegisterField[4];

            for(var i = 0; i < 4; ++i)
            {
                var j = i;
                timers[i] = new SunxiHighSpeedTimerUnit(machine, frequency);
                timers[i].LimitReached += () => OnTimerLimitReached(j);
                interruptFlags[i] = irqStatusRegister.DefineFlagField(i, FieldMode.WriteOneToClear, name: "Tx_IRQ_PEND");
                enableFlags[i] = irqEnableRegister.DefineFlagField(i, name: "Tx_INT_EN");
            }

            var innerConnections = new Dictionary<int, IGPIO>();
            for(var i = 0; i < 4; ++i)
            {
                innerConnections[i] = new GPIO();
            }
            Connections = new ReadOnlyDictionary<int, IGPIO>(innerConnections);
        }
开发者ID:rte-se,项目名称:emul8,代码行数:25,代码来源:SunxiHighSpeedTimer.cs

示例5: GameState

        private GameState(
            Game game,
            ReadOnlyCollection<string> playerIds,
            ReadOnlyCollection<Card> deck,
            ReadOnlyDictionary<string, int> scores,
            ReadOnlyDictionary<string, ReadOnlyCollection<Card>> hands,
            int dealer,
            int turn,
            ReadOnlyCollection<Premise> proof,
            bool isRoundOver)
        {
            if (game == null)
            {
                throw new ArgumentNullException("game");
            }

            this.game = game;

            this.playerIds = playerIds;
            this.deck = deck;
            this.scores = scores;
            this.hands = hands;
            this.dealer = dealer;
            this.turn = turn;
            this.proof = proof;
            this.isRoundOver = isRoundOver;
        }
开发者ID:otac0n,项目名称:Therefore,代码行数:27,代码来源:GameState.cs

示例6: ConflictingVersionRequirementsException

 public ConflictingVersionRequirementsException(string message, AppIdentifier dependency,
     IDictionary<AppIdentifier, string> requiredVersionsByDependent)
     : base(message)
 {
     Dependency = dependency;
     RequiredVersionsByDependent = new ReadOnlyDictionary<AppIdentifier, string>(requiredVersionsByDependent);
 }
开发者ID:vtex,项目名称:apps-client-net,代码行数:7,代码来源:ConflictingVersionRequirementsException.cs

示例7: Build

		public void Build()
		{
			var baseType = typeof(IBuilderTest);
			var handlers = new ReadOnlyDictionary<int, ReadOnlyCollection<HandlerInformation>>(
				new Dictionary<int, ReadOnlyCollection<HandlerInformation>>());
			var namespaces = new SortedSet<string> { baseType.Namespace };
			var options = new RockOptions();

			var builder = new InMemoryBuilder(baseType, handlers, namespaces, options, false);
			builder.Build();

			Assert.AreSame(baseType, builder.BaseType, nameof(builder.BaseType));
			Assert.AreSame(handlers, builder.Handlers, nameof(builder.Handlers));
			Assert.AreSame(namespaces, builder.Namespaces, nameof(builder.Namespaces));
			Assert.AreEqual(0, namespaces.Count, nameof(namespaces.Count));

			Assert.AreSame(options, builder.Options, nameof(builder.Options));
			Assert.IsNotNull(builder.Tree, nameof(builder.Tree));
			Assert.IsTrue(!string.IsNullOrWhiteSpace(builder.TypeName), nameof(builder.TypeName));

			var tree = builder.Tree.ToString();

			Assert.IsFalse(tree.StartsWith("#pragma warning disable CS0618"));
			Assert.IsFalse(tree.Contains("#pragma warning disable CS0672"));
			Assert.IsFalse(tree.Contains("#pragma warning restore CS0672"));
			Assert.IsFalse(tree.EndsWith("#pragma warning restore CS0618"));
		}
开发者ID:JamesBender,项目名称:Rocks,代码行数:27,代码来源:InMemoryBuilderTests.cs

示例8: SimpleSentenceForm

 private SimpleSentenceForm(int name, int arity, ReadOnlyDictionary<int, SimpleSentenceForm> functions, int tupleSize)
 {
     _arity = arity;
     _functions = functions;
     Name = name;
     TupleSize = tupleSize;
 }
开发者ID:druzil,项目名称:nggp-base,代码行数:7,代码来源:SimpleSentenceForm.cs

示例9: Initializers

        static Initializers()
        {
            var timer = new Stopwatch();
            timer.Start();

            var initializers = new Dictionary<ID, ITemplateInitializer>();

            var initializerTypes = ProviderResolver.Current.TypeListProvider.CreateTypeList().ImplementingInterface(typeof(ITemplateInitializer));

            foreach (var initializer in initializerTypes)
            {
                var instance = (ITemplateInitializer)Activator.CreateInstance(initializer);

                if (initializers.ContainsKey(instance.InitializesTemplateId))
                {
                    throw new InvalidOperationException("Synthesis: Multiple initializers were found for template {0} ({1}, {2}).".FormatWith(instance.InitializesTemplateId, initializers[instance.InitializesTemplateId].GetType().FullName, instance.GetType().FullName));
                }

                // ignore test and standard template initializers
                if (instance.InitializesTemplateId == ID.Null) continue;

                initializers.Add(instance.InitializesTemplateId, instance);
            }

            InitializerCache = new ReadOnlyDictionary<ID, ITemplateInitializer>(initializers);

            timer.Stop();
            Log.Info("Synthesis: Initialized template initializer cache (" + InitializerCache.Count + " templates) in " + timer.ElapsedMilliseconds + " ms", InitializerCache);
        }
开发者ID:Gobiner,项目名称:Synthesis,代码行数:29,代码来源:Initializers.cs

示例10: CheckDuchyKingdom

		private void CheckDuchyKingdom( ReadOnlyDictionary<string, Title> titles )
		{
			foreach( var pair in titles )
			{
				if( TaskStatus.Abort )
					return;

				Log( " --" + pair.Value.TitleID );

				Title d = pair.Value;

				if ( d.HolyOrder || d.Mercenary )
					m_options.RuleSet.IgnoredTitles.Add( d.TitleID );

				if( d.Primary || d.Landless || ( d.IsTitular && d.Capital == -1 ) )
					continue;

				if( d.Capital == -1 )
					d.Capital = d.SubTitles.ElementAt( 0 ).Value.Capital;

				if( !m_options.Data.Provinces.ContainsKey( d.Capital ) )
				{
					d.Primary = true;
					continue;
				}

				if( String.IsNullOrEmpty( d.Culture ) )
					d.Culture = m_options.Data.Provinces[d.Capital].Culture;
				if( String.IsNullOrEmpty( d.Religion ) )
					d.Religion = m_options.Data.Provinces[d.Capital].Religion;
			}
		}
开发者ID:Measter,项目名称:TitleGenerator,代码行数:32,代码来源:CheckTitleTask.cs

示例11: Compile

		public void Compile()
		{
			var baseType = typeof(IBuilderTest);
			var handlers = new ReadOnlyDictionary<int, ReadOnlyCollection<HandlerInformation>>(
				new Dictionary<int, ReadOnlyCollection<HandlerInformation>>());
			var namespaces = new SortedSet<string> { baseType.Namespace };
			var options = new RockOptions();

			var builder = new InMemoryBuilder(baseType, handlers, namespaces, options, false);
			builder.Build();

			var trees = new[] { builder.Tree };
			var compiler = new InMemoryCompiler(trees, options.Optimization, 
				new List<Assembly> { baseType.Assembly }.AsReadOnly(), builder.IsUnsafe,
				options.AllowWarnings);
			compiler.Compile();

			Assert.AreEqual(options.Optimization, compiler.Optimization, nameof(compiler.Optimization));
			Assert.AreSame(trees, compiler.Trees, nameof(compiler.Trees));
			Assert.IsNotNull(compiler.Result, nameof(compiler.Result));
			Assert.IsNotNull(
				(from type in compiler.Result.GetTypes()
				where baseType.IsAssignableFrom(type)
				select type).Single());
		}
开发者ID:JamesBender,项目名称:Rocks,代码行数:25,代码来源:InMemoryCompilerTests.cs

示例12: Element

 public Element(string name, string argument, IDictionary<string, string> attributes, IList<IElement> elements)
 {
     Name = name;
     Argument = argument;
     Attributes = new ReadOnlyDictionary<string, string>(attributes);
     Elements = new ReadOnlyCollection<IElement>(elements);
 }
开发者ID:rabitarochan,项目名称:Fluentd.Net,代码行数:7,代码来源:Element.cs

示例13: PasswordProviderPool

        static PasswordProviderPool()
        {
            var types = new[] {
                typeof(PasswordProviderV1),
                typeof(PasswordProviderV2),
            };

            Providers = types
                .Select(s => new ProviderInfo
                {
                    Version = s.GetCustomAttributes(typeof(PasswordProviderVersionAttribute), false)
                        .Cast<PasswordProviderVersionAttribute>()
                        .Single()
                        .Version,
                    Type = s,
                    Creater = Expression.Lambda<PasswordProviderActivator>(Expression.New(s.GetConstructors().Single()))
                        .Compile(),
                })
                .OrderByDescending(s => s.Version)
                .ToArray();

            Pool = new ReadOnlyDictionary<int, ConcurrentBag<PasswordProvider>>(
                Providers
                    .ToDictionary(s => s.Version, s => new ConcurrentBag<PasswordProvider>()));

            LastVersion = Providers.Max(s => s.Version);
        }
开发者ID:supuy-ruby,项目名称:GitCandy,代码行数:27,代码来源:PasswordProviderPool.cs

示例14: NodeAnalogInput

        private NodeAnalogInput(ReadOnlyDictionary<FieldIdentifier, FieldBase> Fields,
            ReadOnlyCollection<NodeBase> Children)
            : base(Fields, Children)
        {
            m_Signal = new SingleChild<NodeSignal, NodeAnalogInput>(this);

            // Validation
            if (Code == null)
            {
                throw new ArgumentNullException(m_CodeName);
            }
            if (Address == null)
            {
                throw new ArgumentNullException(m_AddressName);
            }
            if (Forced == null)
            {
                throw new ArgumentNullException(m_ForcedName);
            }
            if (ForcedValue == null)
            {
                throw new ArgumentNullException(m_ForcedValueName);
            }
            if (Signal == null)
            {
                throw new ArgumentNullException(m_SignalName);
            }
            if (InputName == null)
            {
                throw new ArgumentNullException(m_InputNameName);
            }
        }
开发者ID:EdWeller,项目名称:SoapboxSnap,代码行数:32,代码来源:NodeAnalogInput.cs

示例15: Execute

        public async Task Execute()
        {
            var loggers = new List<ILog>
            {
                new ConsoleLog()
            };

            if (!string.IsNullOrEmpty(LogTo))
                loggers.Add(new FileLog(LogTo));

            var engine = TemplatingEngine.Init(loggers.ToArray());

            var alterationDirectories = TemplatePaths
                .Select(x => Path.Combine(x, "alterations\\base"))
                .Where(Directory.Exists)
                .ToList();

            alterationDirectories.AddRange(TemplatePaths
                .Select(x => Path.Combine(x, $"alterations\\{Template}"))
                .Where(Directory.Exists));

            var substitutions = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>
            {
                {"PROJECT_NAME", Name},
                {"SOLUTION", Solution}
            });

            foreach (var alterationDirectory in alterationDirectories)
                await
                    engine.RunTemplate(
                        new AlterationTemplateType(Name, Location, Path.Combine(Location, $"src\\{Name}"), substitutions),
                        alterationDirectory).ConfigureAwait(false);
        }
开发者ID:SuperGlueFx,项目名称:SuperGlue.CommandLine,代码行数:33,代码来源:AlterCommand.cs


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