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


C# ReadOnlyCollection.Contains方法代码示例

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


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

示例1: TestContains

    public void TestContains() {
      int[] integers = new int[] { 1234, 6789 };
      ReadOnlyCollection<int> testCollection = new ReadOnlyCollection<int>(integers);

      Assert.IsTrue(testCollection.Contains(1234));
      Assert.IsFalse(testCollection.Contains(4321));
    }
开发者ID:pr0gramm3r1,项目名称:AngryTanks,代码行数:7,代码来源:ReadOnlyCollection.Test.cs

示例2: ProcessCommandLine

        private void ProcessCommandLine(ReadOnlyCollection<string> commandLine)
        {
            if (commandLine.Count > 0)
            {
                if (commandLine.Contains("-nosplash"))
                    TabsterEnvironment.NoSplash = true;
                if (commandLine.Contains("-safemode"))
                    TabsterEnvironment.SafeMode = true;

                ProcessFirstArgForFile(commandLine[0]);
            }
        }
开发者ID:GetTabster,项目名称:Tabster,代码行数:12,代码来源:TabsterSingleInstanceController.cs

示例3: AddFormatSpecifier

 internal static ReadOnlyCollection<string> AddFormatSpecifier(ReadOnlyCollection<string> formatSpecifiers, string formatSpecifier)
 {
     if (formatSpecifiers.Contains(formatSpecifier))
     {
         return formatSpecifiers;
     }
     var builder = ArrayBuilder<string>.GetInstance();
     builder.AddRange(formatSpecifiers);
     builder.Add(formatSpecifier);
     return builder.ToImmutableAndFree();
 }
开发者ID:GloryChou,项目名称:roslyn,代码行数:11,代码来源:Formatter.cs

示例4: FindFullMatchIndex

        public override int FindFullMatchIndex(ReadOnlyCollection<int> matchIndexes)
        {
            var fullMatch = this.ComboBox.Items.OfType<DataItem>().FirstOrDefault(i => i.Title.Length == charLenght);
            if (fullMatch == null)
            {
                return -1;
            }

            var fullMatchIndex = this.ComboBox.Items.IndexOf(fullMatch);
            if (matchIndexes.Contains(fullMatchIndex))
            {
                return fullMatchIndex;
            }

            return -1;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:16,代码来源:StringLenghtFilteringBehavior.cs

示例5: AddressesChanged

 public bool AddressesChanged(ReadOnlyCollection<IPAddress> addresses)
 {
     lock (this.ThisLock)
     {
         if (addresses.Count != this.localAddresses.Length)
         {
             return true;
         }
         foreach (IPAddress address in this.localAddresses)
         {
             if (!addresses.Contains(address))
             {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:PeerIPHelper.cs

示例6: InitializeViews

        internal List<ILayoutPanelElement> InitializeViews()
        {
            ReadOnlyCollection<string> enabledWidgets = new ReadOnlyCollection<string>(SettingsManager.Instance.GetSetting("CustomOperationViewer", "WidgetConfiguration").GetValue<ExportConfiguration>().GetEnabledExports());
            foreach (ExportedType export in ExportedTypeLibrary.GetExports(typeof(IUIWidget)).Where(j => enabledWidgets.Contains(j.Attribute.Alias)))
            {
                var iuiWidget = export.CreateInstance<IUIWidget>();

                string jobName = iuiWidget.GetType().Name;
                Logger.Instance.LogFormat(LogType.Info, this, "Initializing ViewPlugin type '{0}'...", jobName);

                try
                {
                    if (!iuiWidget.Initialize())
                    {
                        Logger.Instance.LogFormat(LogType.Warning, this, "ViewPlugin type '{0}' initialization failed. The ViewPlugin will not be executed.", jobName);
                        continue;
                    }
                    var pane =
                        new LayoutAnchorablePane(new LayoutAnchorable
                                                     {
                                                         Content = iuiWidget.UIElement,
                                                         ContentId = iuiWidget.ContentGuid,
                                                         Title = iuiWidget.Title,
                                                         CanClose = false,
                                                         CanHide = false
                                                     });

                    _PanelElements.Add(pane);
                    _Widgets.Add(iuiWidget);
                    Logger.Instance.LogFormat(LogType.Info, this, "ViewPlugin type '{0}' initialization successful.", jobName);
                }
                catch (Exception ex)
                {
                    Logger.Instance.LogFormat(LogType.Error, this, "An error occurred while initializing ViewPlugin type '{0}'. The error message was: {1}", jobName, ex.Message);
                }
            }
            return _PanelElements;
        }
开发者ID:Knatter33,项目名称:AlarmWorkflow,代码行数:38,代码来源:WidgetManager.cs

示例7: TestCollection

        public void TestCollection()
        {
            // Default ctor.
            var data = Enumerable.Range(1, 5).ToArray();
            var col = new ReadOnlyCollection<int>(data);

            Assert.AreEqual(5, col.Count);
            Assert.IsTrue(col.IsReadOnly);
            CollectionAssert.AreEqual(data, col);

            Assert.IsTrue(col.GetEnumerator().MoveNext());
            Assert.IsTrue(((IEnumerable) col).GetEnumerator().MoveNext());

            Assert.IsTrue(col.Contains(4));

            var arr = new int[5];
            col.CopyTo(arr, 0);
            CollectionAssert.AreEqual(data, arr);

            Assert.Throws<NotSupportedException>(() => col.Add(1));
            Assert.Throws<NotSupportedException>(() => col.Clear());
            Assert.Throws<NotSupportedException>(() => col.Remove(1));
        }
开发者ID:kjniemi,项目名称:ignite,代码行数:23,代码来源:ReadOnlyCollectionTest.cs

示例8: goToNewlyOpenedWindowhandle

 private static void goToNewlyOpenedWindowhandle(
    ReadOnlyCollection<string> currentWindowHandles)
 {
     if (null != CurrentData.CurrentWebDriver.WindowHandles && 
         currentWindowHandles.Count < CurrentData.CurrentWebDriver.WindowHandles.Count) {
         
         string newWindowhandle = string.Empty;
         // go to a newly opened window handle
         foreach (string  windowhandle in CurrentData.CurrentWebDriver.WindowHandles) {
             
             if (!currentWindowHandles.Contains(windowhandle)) {
                 newWindowhandle = windowhandle;
                 break;
             }
             
         }
         
         currentWindowHandles = CurrentData.CurrentWebDriver.WindowHandles;
         CurrentData.CurrentWebDriver.SwitchTo().Window(newWindowhandle);
         
     }
 }
开发者ID:MatkoHanus,项目名称:STUPS,代码行数:22,代码来源:Recorder.cs

示例9: TreeFile

            public TreeFile(UpdateFile uf, ReadOnlyCollection<string> updateFiles, string newBasePath)
            {
                FullPath = uf.RelativePath.Replace('/', '\\');
                Size = uf.Length;

                if (!updateFiles.Contains(Path.Combine(newBasePath, uf.RelativePath), StringComparer.OrdinalIgnoreCase))
                    State = (int)FileState.Deleted;
                else if (uf.Matches(newBasePath))
                    State = (int)FileState.Identical;
                else
                    State = (int)FileState.Changed;
            }
开发者ID:ShomreiTorah,项目名称:Utilities,代码行数:12,代码来源:UpdateDetails.cs

示例10: ContainsUsesEqualsMethod

		public void ContainsUsesEqualsMethod() {
			var l = new ReadOnlyCollection<C>(new[] { new C(1), new C(2), new C(3) });
			Assert.IsTrue(l.Contains(new C(2)));
			Assert.IsFalse(l.Contains(new C(4)));
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:5,代码来源:ReadOnlyCollectionTests.cs

示例11: ContainsWorks

		public void ContainsWorks() {
			var l = new ReadOnlyCollection<string>(new[] { "x", "y" });
			Assert.IsTrue(l.Contains("x"));
			Assert.IsFalse(l.Contains("z"));
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:5,代码来源:ReadOnlyCollectionTests.cs

示例12: ICollectionContainsWorks

		public void ICollectionContainsWorks() {
			IList<string> l = new ReadOnlyCollection<string>(new[] { "x", "y", "z" });
			Assert.IsTrue(l.Contains("y"));
			Assert.IsFalse(l.Contains("a"));
		}
开发者ID:ShuntaoChen,项目名称:SaltarelleCompiler,代码行数:5,代码来源:ReadOnlyCollectionTests.cs

示例13: checkContains

 private static int checkContains(ReadOnlyCollection<String> coll, String str)
 {
     if (!coll.Contains(str))
     {
         return -1;
     }
     else
     {
         return coll.IndexOf(str);
     }
 }
开发者ID:Vervolk22,项目名称:JavaCompiler,代码行数:11,代码来源:SyntaxTable.cs

示例14: manager_RoleGrantsRefreshed

 void manager_RoleGrantsRefreshed(ReadOnlyCollection<UserRole> affected)
 {
     if (affected.Contains(this))
     {
         privManager.DownloadPrivileges();
         roleManager.DownloadData();
     }
 }
开发者ID:finrod123,项目名称:oradmin,代码行数:8,代码来源:UserRole.cs


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