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


C# ArrayList.GetHashCode方法代码示例

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


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

示例1: MergeStringArray

        // ����: �ϲ������ַ�������
        // parameter:
        //        sourceLeft: Դ�������
        //        sourceRight: Դ�ұ�����
        //        targetLeft: Ŀ���������
        //        targetMiddle: Ŀ���м�����
        //        targetRight: Ŀ���ұ�����
        // �����׳��쳣
        public static void MergeStringArray(ArrayList sourceLeft,
			ArrayList sourceRight,
			List<string> targetLeft,
			List<string> targetMiddle,
			List<string> targetRight)
        {
            int i = 0;
            int j = 0;
            string strLeft;
            string strRight;
            int ret;
            while (true)
            {
                strLeft = null;
                strRight = null;
                if (i >= sourceLeft.Count)
                {
                    i = -1;
                }
                else if (i != -1)
                {
                    try
                    {
                        strLeft = (string)sourceLeft[i];
                    }
                    catch
                    {
                        Exception ex = new Exception("i="+Convert.ToString(i)+"----Count="+Convert.ToString(sourceLeft.Count)+"<br/>");
                        throw(ex);
                    }
                }
                if (j >= sourceRight.Count)
                {
                    j = -1;
                }
                else if (j != -1)
                {
                    try
                    {
                        strRight = (string)sourceRight[j];
                    }
                    catch
                    {
                        Exception ex = new Exception("j="+Convert.ToString(j)+"----Count="+Convert.ToString(sourceLeft.Count)+sourceRight.GetHashCode()+"<br/>");
                        throw(ex);
                    }
                }
                if (i == -1 && j == -1)
                {
                    break;
                }

                if (strLeft == null)
                {
                    ret = 1;
                }
                else if (strRight == null)
                {
                    ret = -1;
                }
                else
                {
                    ret = strLeft.CompareTo(strRight);  //MyCompareTo(oldOneKey); //��CompareTO
                }

                if (ret == 0 && targetMiddle != null)
                {
                    targetMiddle.Add(strLeft);
                    i++;
                    j++;
                }

                if (ret<0)
                {
                    if (targetLeft != null && strLeft != null)
                        targetLeft.Add(strLeft);
                    i++;
                }

                if (ret>0 )
                {
                    if (targetRight != null && strRight != null)
                        targetRight.Add(strRight);
                    j++;
                }
            }
        }
开发者ID:renyh1013,项目名称:dp2weixin,代码行数:95,代码来源:DigitalPlatform.cs


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