상속: IList
예제 #1
0
		public List Reverse()
		{
			AcquireReaderLock();
			try
			{				
				List reversed = new List(_list);
				reversed._list.Reverse();
				return reversed;
			}
			finally
			{
				ReleaseReaderLock();
			}
		}
예제 #2
0
		/// <summary>
		/// 
		/// </summary>
		public Array Choose(int count)
		{
			if (_list.Count > count)
			{
				List copy = new List(_list);
				object[] items = new object[count];
				for (int i=0; i<count; ++i)
				{
					items[i] = copy.PopAny();
				}
				return items;
			}
			else
			{
				return ToShuffledArray();
			}
		}
예제 #3
0
		public Array ToShuffledArray(Type elementType)
		{
			List copy = new List(ToArray());
			Array target = Array.CreateInstance(elementType, copy.Count);
			for (int i=0; i<target.Length; ++i)
			{
				target.SetValue(copy.PopAny(), i);
			}
			return target;
		}