예제 #1
0
        private void ApplySortingIfSpecified(int[] rghvo, XmlNode specialAttrsNode)
        {
            string sort = XmlUtils.GetOptionalAttributeValue(specialAttrsNode, "sort", null);

            if (sort == null)
            {
                return;
            }
            // sort the items in this collection, based on the SortKey property
            bool ascending = sort.ToLowerInvariant() == "ascending";
            var  hvos      = new List <int>(rghvo);

            using (var comparer = new CmObjectComparer(m_cache))
                hvos.Sort(comparer);
            if (!ascending)
            {
                hvos.Reverse();
            }
            hvos.CopyTo(rghvo);
        }
예제 #2
0
		private void ApplySortingIfSpecified(int[] rghvo, XmlNode specialAttrsNode)
		{
			string sort = XmlUtils.GetOptionalAttributeValue(specialAttrsNode, "sort", null);
			if (sort == null)
				return;
			// sort the items in this collection, based on the SortKey property
			bool ascending = sort.ToLowerInvariant() == "ascending";
			var hvos = new List<int>(rghvo);
			using (var comparer = new CmObjectComparer(m_cache))
				hvos.Sort(comparer);
			if (!ascending)
				hvos.Reverse();
			hvos.CopyTo(rghvo);
		}