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


C# Collections.CaseInsensitiveComparer类代码示例

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


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

示例1: Compare

        public int Compare(object x, object y)
        {
            int ret;
            ExplorerListItem first = x as ExplorerListItem;
            ExplorerListItem second = y as ExplorerListItem;

            if (ColumnToSort == 3)
            {
                ret = DateTime.Compare(DateTime.Parse(first.SubItems[ColumnToSort].Text), DateTime.Parse(second.SubItems[ColumnToSort].Text));
            }
            else
            {
                CaseInsensitiveComparer comp = new CaseInsensitiveComparer();

                ret = comp.Compare(first.SubItems[ColumnToSort].Text, second.SubItems[ColumnToSort].Text);
            }

            if (SortingOrder == SortOrder.Ascending)
            {
                return ret;
            }
            else if(SortingOrder == SortOrder.Descending)
            {
                return (-ret);
            }
            else
            {
                return 0;
            }
        }
开发者ID:Breakpoint21,项目名称:backup.dh,代码行数:30,代码来源:ListViewColumnSorter.cs

示例2: LvwColumnSorter

 /// <summary>
 ///     构造函数
 /// </summary>
 public LvwColumnSorter()
 {
     SortColumn = 0; // 默认按第一列排序
     Order = SortOrder.None; // 排序方式为不排序
     _objectCompare = new CaseInsensitiveComparer(); // 初始化CaseInsensitiveComparer类对象
     CompareMethod = SortMethod.StringCompare; //是否使用Size比较
 }
开发者ID:lizhi5753186,项目名称:MongoCola,代码行数:10,代码来源:LvwColumnSorter.cs

示例3: ListViewColumnSorter

 public ListViewColumnSorter(bool sortByDate)
 {
     this.sortByDate = sortByDate;
     ColumnToSort = 0;
     OrderOfSort = SortOrder.None;
     ObjectCompare = new CaseInsensitiveComparer();
 }
开发者ID:stuartsoorholtz,项目名称:openmovement,代码行数:7,代码来源:ListViewColumnSorter.cs

示例4: Compare

        public int Compare(object x, object y)
        {
            CultureInfo ci = new CultureInfo("sv");
            CaseInsensitiveComparer aComparer = null;
			aComparer = new CaseInsensitiveComparer(ci);
            return aComparer.Compare(x, y);
        }
开发者ID:ppatoria,项目名称:SoftwareDevelopment,代码行数:7,代码来源:SWEDISHNAMECOMPARER.CS

示例5: TestCompare_Culture

		public void TestCompare_Culture ()
		{
			CultureInfo originalCulture = Thread.CurrentThread.CurrentCulture;

			try {
				Thread.CurrentThread.CurrentCulture = new CultureInfo ("tr-TR");

				// the default ctor is initialized using Thread.CurrentCulture
				CaseInsensitiveComparer cic = new CaseInsensitiveComparer ();
				Assert.AreEqual (-1, cic.Compare ("I", "i"), "#A1");
				Assert.AreEqual (0, cic.Compare ("A", "a"), "#A2");

				// changing the current culture does not affect an already
				// initialized CaseInsensitiveComparer
				Thread.CurrentThread.CurrentCulture = new CultureInfo ("nl-BE");
				Assert.AreEqual (-1, cic.Compare ("I", "i"), "#B1");
				Assert.AreEqual (0, cic.Compare ("A", "a"), "#B2");

				// but it does affect new instances
				cic = new CaseInsensitiveComparer ();
				Assert.AreEqual (0, cic.Compare ("I", "i"), "#C1");
				Assert.AreEqual (0, cic.Compare ("A", "a"), "#C2");

				// if the culture is explicitly set, then the thread culture is
				// ignored
				cic = new CaseInsensitiveComparer (new CultureInfo ("tr-TR"));
				Assert.AreEqual (-1, cic.Compare ("I", "i"), "#D1");
				Assert.AreEqual (0, cic.Compare ("A", "a"), "#D2");
			} finally {
				// restore original culture
				Thread.CurrentThread.CurrentCulture = originalCulture;
			}
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:33,代码来源:CaseInsensitiveComparerTest.cs

示例6: ListViewColumnSorter

        /// <summary>
        /// Class constructor.  Initializes various elements
        /// </summary>
        public ListViewColumnSorter()
        {
            // Initialize the CaseInsensitiveComparer object
            ObjectCompare = new CaseInsensitiveComparer();

            ListViewColumnSorter_LoadSettings();
        }
开发者ID:falerin,项目名称:Sims4Tools,代码行数:10,代码来源:SortingListviews.cs

示例7: Compare

 public virtual int Compare( object x, object y )
 {
     ListItem a = (ListItem)x;
     ListItem b = (ListItem)y;
     CaseInsensitiveComparer c = new CaseInsensitiveComparer();
     return c.Compare(a.Text, b.Text);
 }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:7,代码来源:ListItemComparer.cs

示例8: ColumnSorter

 public ColumnSorter()
 {
     _sortColumn = 0;
       _direction = SortOrder.None;
       _stringComparer = new CaseInsensitiveComparer();
       _numericComparer = new NumericStringComparer();
 }
开发者ID:nick-chromium,项目名称:vs-chromium,代码行数:7,代码来源:ColumnSorter.cs

示例9: ListViewColumnSorter

 //---------------------------------------------------------------------
 public ListViewColumnSorter()
 {
     ColumnToSort = 0;
     OrderOfSort = SortOrder.None;
     ObjectCompare = new CaseInsensitiveComparer();
     Order = SortOrder.Ascending;
 }
开发者ID:JanVanMeirvenne,项目名称:mpviewer,代码行数:8,代码来源:SortableListView.cs

示例10: ListViewColumnSorter

		/// <summary>
		/// Class constructor.  Initializes various elements
		/// </summary>
		public ListViewColumnSorter() {
			// Initialize the sort order to 'none'
			_orderOfSort = SortOrder.None;

			// Initialize the CaseInsensitiveComparer object
			_objectCompare = new CaseInsensitiveComparer(CultureInfo.CurrentCulture);
		}
开发者ID:Alex-Jaeger,项目名称:BitcoinFindAndRecover,代码行数:10,代码来源:ListViewColumnSorter.cs

示例11: ListViewColumnSorter

 public ListViewColumnSorter()
 {
     ColumnToSort = 0;
       OrderOfSort = SortOrder.None;
       numCompare = false;
       ObjectCompare = new CaseInsensitiveComparer();
 }
开发者ID:hdf,项目名称:Patcher2,代码行数:7,代码来源:ListViewColumnSorterClass.cs

示例12: ListViewColumnSorter

 public ListViewColumnSorter()
 {
     ColumnOrder_ = new List<int>();
     OrderOfSort_ = new List<SortOrder>();
     ObjectCompare_ = new CaseInsensitiveComparer();
     NameOfDay_ = new List<bool>();
     LeadingZeros_ = new List<bool>();
 }
开发者ID:Jaren14,项目名称:unitimetable,代码行数:8,代码来源:ListViewColumnSorter.cs

示例13: TestCompare

		public void TestCompare () {
			CaseInsensitiveComparer cic = new CaseInsensitiveComparer ();

			AssertEquals(cic.Compare ("WILD WEST", "Wild West"),0);
			AssertEquals(cic.Compare ("WILD WEST", "wild west"),0);
			Assert(cic.Compare ("Zeus", "Mars") > 0);
			Assert(cic.Compare ("Earth", "Venus") < 0);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:CaseInsensitiveComparerTest.cs

示例14: ListViewColumnSorter

 public ListViewColumnSorter(int numericalColumn)
 {
     this.numericalColumn = numericalColumn;
     SortColumn = numericalColumn;
     Order = SortOrder.None;
     ObjectCompareAsText = new CaseInsensitiveComparer();
     ObjectCompareAsNumbers = new NumericalComparer();
 }
开发者ID:Kalroth,项目名称:turtletfs,代码行数:8,代码来源:ListViewColumnSorter.cs

示例15: ListViewItemComparer

 // Class constructor, initializes various elements
 public ListViewItemComparer()
 {
     // Initialize the column to '0'
     this.ColumnToSort = 0;
     // Initialize the sort order to 'none'
     this.OrderOfSort = SortOrder.None;
     // Initialize the CaseInsensitiveComparer object
     this.ObjectCompare = new CaseInsensitiveComparer();
 }
开发者ID:hksonngan,项目名称:sharptracing,代码行数:10,代码来源:ListViewItemComparer.cs


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