• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ReadOnlyCollection类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ForCSharpStatement

 internal ForCSharpStatement(ReadOnlyCollection<ParameterExpression> variables, ReadOnlyCollection<Expression> initializers, Expression test, ReadOnlyCollection<Expression> iterators, Expression body, LabelTarget breakLabel, LabelTarget continueLabel)
     : base(test, body, breakLabel, continueLabel)
 {
     Variables = variables;
     Initializers = initializers;
     Iterators = iterators;
 }
开发者ID:taolin123,项目名称:ExpressionFutures,代码行数:7,代码来源:ForCSharpStatement.cs


示例2: VisitParameterExpressionList

 protected virtual ReadOnlyCollection<ParameterExpression> VisitParameterExpressionList(ReadOnlyCollection<ParameterExpression> original)
 {
     List<ParameterExpression> list = null;
     for (int i = 0, n = original.Count; i < n; i++)
     {
         ParameterExpression p = (ParameterExpression) this.Visit(original[i]);
         if (list != null)
         {
             list.Add(p);
         }
         else if (p != original[i])
         {
             list = new List<ParameterExpression>(n);
             for (int j = 0; j < i; j++)
             {
                 list.Add(original[j]);
             }
             list.Add(p);
         }
     }
     if (list != null)
     {
         return list.AsReadOnly();
     }
     return original;
 }
开发者ID:melpadden,项目名称:Lambchop.Net,代码行数:26,代码来源:ConversionVisitor.cs


示例3: EnumDefinition

        /// <summary>
        /// Initializes a new instance of the EnumDefinition class
        /// Populates this object with information extracted from the XML
        /// </summary>
        /// <param name="theNode">XML node describing the Enum object</param>
        /// <param name="manager">The data dictionary manager constructing this type.</param>
        public EnumDefinition(XElement theNode, DictionaryManager manager)
            : base(theNode, TypeId.EnumType)
        {
            // ByteSize may be set either directly as an integer or by inference from the Type field.
            // If no Type field is present then the type is assumed to be 'int'
            if (theNode.Element("ByteSize") != null)
            {
                SetByteSize(theNode.Element("ByteSize").Value);
            }
            else
            {
                string baseTypeName = theNode.Element("Type") != null ? theNode.Element("Type").Value : "int";

                BaseType = manager.GetElementType(baseTypeName);
                BaseType = DictionaryManager.DereferenceTypeDef(BaseType);

                FixedSizeBytes = BaseType.FixedSizeBytes.Value;
            }

            // Common properties are parsed by the base class.
            // Remaining properties are the Name/Value Literal elements
            List<LiteralDefinition> theLiterals = new List<LiteralDefinition>();
            foreach (var literalNode in theNode.Elements("Literal"))
            {
                theLiterals.Add(new LiteralDefinition(literalNode));
            }

            m_Literals = new ReadOnlyCollection<LiteralDefinition>(theLiterals);

            // Check the name. If it's null then make one up
            if (theNode.Element("Name") == null)
            {
                Name = String.Format("Enum_{0}", Ref);
            }
        }
开发者ID:DaveRobSwEng,项目名称:CSharpUtilities,代码行数:41,代码来源:EnumDefinition.cs


示例4: PatternMatchRuleProcessor

        private PatternMatchRuleProcessor(ReadOnlyCollection<PatternMatchRule> rules)
        {
            Debug.Assert(rules.Count() != 0, "At least one PatternMatchRule is required");
            Debug.Assert(rules.Where(r => r == null).Count() == 0, "Individual PatternMatchRules must not be null");

            ruleSet = rules;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:PatternMatchRuleProcessor.cs


示例5: CollectionContainsResults

        //допилить!!!!!!!!!!!!!
        /// <summary>
        /// Проверяет содержат ли элементы коллекции текст, который задается во втором параметре через запятую по порядку
        /// </summary>
        /// <param name="elements"></param>
        /// <param name="results"></param>
        /// <returns></returns>
        protected bool CollectionContainsResults(ReadOnlyCollection<IWebElement> elements, string results)
        {
            bool containt = true;
            if (elements.Count > 1)
            {
                char[] separators = new char[elements.Count];
                for (int i = 0; i < elements.Count; i++)
                {
                    separators[i] = ',';
                }
                string[] res = results.Split(separators);
                for (int i = 0; i < elements.Count; i++)
                {
                    if (!elements[i].Text.Contains(res[i]))
                    {
                        containt = false;
                    }

                }
            }
            else if (elements.Count == 1)
            {
                if (elements[0].Text.Contains(results))
                {
                    containt = true;
                }
            }
            else
            {
                Assert.Fail("There is no elements");
            }

            return containt;
        }
开发者ID:DMartinov,项目名称:FindCoTests,代码行数:41,代码来源:WebTesting.cs


示例6: ExternalRequirements

 internal ExternalRequirements(Binding context,
     IEnumerable<Expression> links)
     : base(context, null, null)
 {
     Guard.NotNull(links, "links");
     Links = new ReadOnlyCollection<Expression>(new List<Expression>(links));
 }
开发者ID:Aethon,项目名称:odo,代码行数:7,代码来源:ExternalRequirements.cs


示例7: MemberListBinding

        internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers)
#pragma warning disable 618
            : base(MemberBindingType.ListBinding, member)
        {
#pragma warning restore 618
            Initializers = initializers;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:MemberListBinding.cs


示例8: Make

 internal static NewArrayExpression Make(ExpressionType nodeType, Type type, ReadOnlyCollection<Expression> expressions) {
     if (nodeType == ExpressionType.NewArrayInit) {
         return new NewArrayInitExpression(type, expressions);
     } else {
         return new NewArrayBoundsExpression(type, expressions);
     }
 }
开发者ID:madpilot,项目名称:ironruby,代码行数:7,代码来源:NewArrayExpression.cs


示例9: ScaleoutStreamManager

        public ScaleoutStreamManager(Func<int, IList<Message>, Task> send,
                                     Action<int, ulong, ScaleoutMessage> receive,
                                     int streamCount,
                                     TraceSource trace,
                                     IPerformanceCounterManager performanceCounters,
                                     ScaleoutConfiguration configuration)
        {
            if (configuration.QueueBehavior != QueuingBehavior.Disabled && configuration.MaxQueueLength == 0)
            {
                throw new InvalidOperationException(Resources.Error_ScaleoutQueuingConfig);
            }

            _streams = new ScaleoutStream[streamCount];
            _send = send;
            _receive = receive;

            var receiveMapping = new ScaleoutMappingStore[streamCount];

            performanceCounters.ScaleoutStreamCountTotal.RawValue = streamCount;
            performanceCounters.ScaleoutStreamCountBuffering.RawValue = streamCount;
            performanceCounters.ScaleoutStreamCountOpen.RawValue = 0;

            for (int i = 0; i < streamCount; i++)
            {
                _streams[i] = new ScaleoutStream(trace, "Stream(" + i + ")", configuration.QueueBehavior, configuration.MaxQueueLength, performanceCounters);
                receiveMapping[i] = new ScaleoutMappingStore();
            }

            Streams = new ReadOnlyCollection<ScaleoutMappingStore>(receiveMapping);
        }
开发者ID:GaneshBachhao,项目名称:SignalR,代码行数:30,代码来源:ScaleoutStreamManager.cs


示例10: CartToShim

 public CartToShim(int cartId, int userId)
 {
     CartId = cartId;
     UserId = userId;
     CreateDateTime = DateTime.Now;
     CartItems = new ReadOnlyCollection<CartItem>(_cartItems);
 }
开发者ID:RichCzyzewski,项目名称:MicrosoftFakesExamples,代码行数:7,代码来源:CartToShim.cs


示例11: SwitchExpression

 internal SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection<SwitchCase> cases) {
     _type = type;
     _switchValue = switchValue;
     _defaultBody = defaultBody;
     _comparison = comparison;
     _cases = cases;
 }
开发者ID:tnachen,项目名称:ironruby,代码行数:7,代码来源:SwitchExpression.cs


示例12: MakeCallSiteDelegate

        /// <summary>
        /// Finds a delegate type for a CallSite using the types in the ReadOnlyCollection of Expression.
        ///
        /// We take the read-only collection of Expression explicitly to avoid allocating memory (an array
        /// of types) on lookup of delegate types.
        /// </summary>
        internal static Type MakeCallSiteDelegate(ReadOnlyCollection<Expression> types, Type returnType)
        {
            lock (_DelegateCache)
            {
                TypeInfo curTypeInfo = _DelegateCache;

                // CallSite
                curTypeInfo = NextTypeInfo(typeof(CallSite), curTypeInfo);

                // arguments
                for (int i = 0; i < types.Count; i++)
                {
                    curTypeInfo = NextTypeInfo(types[i].Type, curTypeInfo);
                }

                // return type
                curTypeInfo = NextTypeInfo(returnType, curTypeInfo);

                // see if we have the delegate already
                if (curTypeInfo.DelegateType == null)
                {
                    curTypeInfo.MakeDelegateType(returnType, types);
                }

                return curTypeInfo.DelegateType;
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:33,代码来源:DelegateHelpers.netstandard1.7.cs


示例13: AlloyOutliningTaggerWalker

 private AlloyOutliningTaggerWalker(ITreeNodeStream input, ReadOnlyCollection<IToken> tokens, AlloyOutliningTaggerProvider provider, ITextSnapshot snapshot)
     : base(input, snapshot, provider.OutputWindowService)
 {
     _tokens = tokens;
     _provider = provider;
     _snapshot = snapshot;
 }
开发者ID:sebandraos,项目名称:LangSvcV2,代码行数:7,代码来源:AlloyOutliningTaggerWalker.cs


示例14: UnconditionalPolicy

        public UnconditionalPolicy(ReadOnlyCollection<ClaimSet> issuances, DateTime expirationTime)
        {
            if (issuances == null)
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("issuances");

            Initialize(ClaimSet.System, null, issuances, expirationTime);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UnconditionalPolicy.cs


示例15: SimpleCallHelper

        /// <summary>
        /// The helper to create the AST method call node. Will add conversions (Utils.Convert)
        /// to parameters and instance if necessary.
        /// </summary>
        public static MethodCallExpression SimpleCallHelper(Expression instance, MethodInfo method, params Expression[] arguments) {
            ContractUtils.RequiresNotNull(method, "method");
            ContractUtils.Requires(instance != null ^ method.IsStatic, "instance");
            ContractUtils.RequiresNotNullItems(arguments, "arguments");

            ParameterInfo[] parameters = method.GetParameters();

            ContractUtils.Requires(arguments.Length == parameters.Length, "arguments", "Incorrect number of arguments");

            if (instance != null) {
                instance = Convert(instance, method.DeclaringType);
            }

            Expression[] convertedArguments = ArgumentConvertHelper(arguments, parameters);

            ReadOnlyCollection<Expression> finalArgs;
            if (convertedArguments == arguments) {
                // we didn't convert anything, just convert the users original
                // array to a readonly collection.
                finalArgs = convertedArguments.ToReadOnly();
            } else {
                // we already copied the array so just stick it in a readonly collection.
                finalArgs = new ReadOnlyCollection<Expression>(convertedArguments);
            }

            // the arguments are now all correct, avoid re-validating the call parameters and
            // directly create the expression.
            return Expression.Call(instance, method, finalArgs);
        }
开发者ID:techarch,项目名称:ironruby,代码行数:33,代码来源:MethodCallExpression.cs


示例16: Cannon

        public Cannon(Direction2D direction, Vector2i index)
        {
            _direction = direction;
            _worldIndex = index;

            _readOnlyBullets = new ReadOnlyCollection<Bullet>(_bullets);
        }
开发者ID:JaakkoLipsanen,项目名称:WVVW,代码行数:7,代码来源:Cannon.cs


示例17: DocumentViewerBase

 /// <summary>
 /// Instantiates a new instance of a DocumentViewerBase.
 /// </summary>
 protected DocumentViewerBase()
     : base()
 {
     _pageViews = new ReadOnlyCollection<DocumentPageView>(new List<DocumentPageView>());
     // By default text selection is enabled.
     SetFlags(true, Flags.IsSelectionEnabled);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:DocumentViewerBase.cs


示例18: ReadRecords

        private IEnumerable<Record> ReadRecords(string fileName)
        {
            var stringBuilder = new StringBuilder();

            using (var reader = new StreamReader(fileName))
            {
                ReadOnlyCollection<string> header;
                if (reader.Peek() >= 0)
                {
                    var first = this.ParseLine(reader.ReadLine(), stringBuilder).ToArray();

                    header = new ReadOnlyCollection<string>(first);
                }
                else
                {
                    yield break;
                }

                for (var i = 0; i < this._numberRecordsToSkip && reader.Peek() >= 0; i++)
                {
                    reader.ReadLine();
                }

                while (reader.Peek() >= 0)
                {
                    var items = this.ParseLine(reader.ReadLine(), stringBuilder).ToArray();

                    yield return new Record(header, items);
                }
            }
        }
开发者ID:modulexcite,项目名称:Tx,代码行数:31,代码来源:CsvObservable.cs


示例19: Style

 public Style(string name, StyleCategory category, StyleClassification classification, IList<StyleThreshold> thresholds)
 {
     m_name = name;
     m_category = category;
     m_classification = classification;
     m_thresholds = new ReadOnlyCollection<StyleThreshold>(thresholds);
 }
开发者ID:jlafshari,项目名称:Homebrewing,代码行数:7,代码来源:Style.cs


示例20: AggregateExportProvider

        /// <summary>
        /// Initializes a new instance of the <see cref="AggregateExportProvider"/> class.
        /// </summary>
        /// <param name="providers">The prioritized list of export providers.</param>
        /// <exception cref="ArgumentException">
        ///     <paramref name="providers"/> contains an element that is <see langword="null"/>.
        /// </exception>
        /// <remarks>
        ///     <para>
        ///         The <see cref="AggregateExportProvider"/> will consult the providers in the order they have been specfied when 
        ///         executing <see cref="ExportProvider.GetExports(ImportDefinition,AtomicComposition)"/>. 
        ///     </para>
        ///     <para>
        ///         The <see cref="AggregateExportProvider"/> does not take ownership of the specified providers. 
        ///         That is, it will not try to dispose of any of them when it gets disposed.
        ///     </para>
        /// </remarks>
        public AggregateExportProvider(params ExportProvider[] providers) 
        {
            // NOTE : we optimize for the array case here, because the collection of providers is typically tiny
            // Arrays are much more compact to store and much faster to create and enumerate
            ExportProvider[] copiedProviders = null;
            if (providers != null)
            {
                copiedProviders = new ExportProvider[providers.Length];
                for (int i = 0; i < providers.Length; i++)
                {
                    ExportProvider provider = providers[i];
                    if (provider == null)
                    {
                        throw ExceptionBuilder.CreateContainsNullElement("providers");
                    }

                    copiedProviders[i] = provider;

                    provider.ExportsChanged += this.OnExportChangedInternal;
                    provider.ExportsChanging += this.OnExportChangingInternal;
                }
            }
            else
            {
                copiedProviders = new ExportProvider[] { };
            }

            this._providers = copiedProviders;
            this._readOnlyProviders = new ReadOnlyCollection<ExportProvider>(this._providers);
        }
开发者ID:nlhepler,项目名称:mono,代码行数:47,代码来源:AggregateExportProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ReadOnlyCollectionBuilder类代码示例发布时间:2022-05-24
下一篇:
C# ReadOnlyArray类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap