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


C# IType.IsEqual方法代码示例

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


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

示例1: CountOccurrences

        /// <summary>
        /// Counts the number of times that the <paramref name="element"/> occurs
        /// in the <paramref name="list"/>.
        /// </summary>
        /// <param name="element">The element to find in the list.</param>
        /// <param name="list">The <see cref="IList"/> to search.</param>
        /// <param name="elementType">The <see cref="IType"/> that can determine equality.</param>
        /// <returns>
        /// The number of occurrences of the element in the list.
        /// </returns>
        private int CountOccurrences(object element, IList list, IType elementType)
        {
            int result = 0;
            foreach (object obj in list)
            {
                if (elementType.IsEqual(element, obj, EntityMode.Poco))
                {
                    result++;
                }
            }

            return result;
        }
开发者ID:zibler,项目名称:zibler,代码行数:23,代码来源:PersistentBag.cs

示例2: NeedsInserting

		public override bool NeedsInserting(object entry, int i, IType elemType)
		{
			IList sn = (IList) GetSnapshot();
			EntityMode entityMode = Session.EntityMode;

			if (sn.Count > i && elemType.IsSame(sn[i], entry, entityMode))
			{
				// a shortcut if its location didn't change
				return false;
			}
			else
			{
				//search for it
				foreach (object old in sn)
				{
					if (elemType.IsEqual(old, entry, entityMode))
					{
						return false;
					}
				}
				return true;
			}
		}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:23,代码来源:PersistentBag.cs

示例3: GetDeletes

        // For a one-to-many, a <bag> is not really a bag;
        // it is *really* a set, since it can't contain the
        // same element twice. It could be considered a bug
        // in the mapping dtd that <bag> allows <one-to-many>.
        // Anyway, here we implement <set> semantics for a
        // <one-to-many> <bag>!
        public override IEnumerable GetDeletes(IType elemType, bool indexIsFormula)
        {
            ArrayList deletes = new ArrayList();
            IList sn = (IList) GetSnapshot();

            int i = 0;

            foreach (object oldObject in sn)
            {
                bool found = false;
                if (bag.Count > i && elemType.IsEqual(oldObject, bag[i++], EntityMode.Poco))
                {
                    //a shortcut if its location didn't change!
                    found = true;
                }
                else
                {
                    //search for it
                    foreach (object newObject in bag)
                    {
                        if (elemType.IsEqual(oldObject, newObject, EntityMode.Poco))
                        {
                            found = true;
                            break;
                        }
                    }
                }
                if (!found)
                {
                    deletes.Add(oldObject);
                }
            }

            return deletes;
        }
开发者ID:zibler,项目名称:zibler,代码行数:41,代码来源:PersistentBag.cs


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