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


C# Collections.IList类代码示例

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


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

示例1: ListToString

		/// <summary>
		/// Returns a string representation of this IList.
		/// </summary>
		/// <remarks>
		/// The string representation is a list of the collection's elements in the order 
		/// they are returned by its IEnumerator, enclosed in square brackets ("[]").
		/// The separator is a comma followed by a space i.e. ", ".
		/// </remarks>
		/// <param name="coll">Collection whose string representation will be returned</param>
		/// <returns>A string representation of the specified collection or "null"</returns>
		public static string ListToString(IList coll)
		{
			StringBuilder sb = new StringBuilder();
		
			if (coll != null)
			{
				sb.Append("[");
				for (int i = 0; i < coll.Count; i++) 
				{
					if (i > 0)
						sb.Append(", ");

					object element = coll[i];
					if (element == null)
						sb.Append("null");
					else if (element is IDictionary)
						sb.Append(DictionaryToString((IDictionary)element));
					else if (element is IList)
						sb.Append(ListToString((IList)element));
					else
						sb.Append(element.ToString());

				}
				sb.Append("]");
			}
			else
				sb.Insert(0, "null");

			return sb.ToString();
		}
开发者ID:Fedorm,项目名称:core-master,代码行数:40,代码来源:CollectionUtils.cs

示例2: BitSet

 /// <summary>Construction from a list of integers </summary>
 public BitSet(IList items)
 	: this(BITS)
 {
     for (int i = 0; i < items.Count; i++)
     {
         int v = (int)items[i];
         Add(v);
     }
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:10,代码来源:BitSet.cs

示例3: DisjunctionSumScorer

		/// <summary>Construct a <code>DisjunctionScorer</code>.</summary>
		/// <param name="subScorers">A collection of at least two subscorers.
		/// </param>
		/// <param name="minimumNrMatchers">The positive minimum number of subscorers that should
		/// match to match this query.
		/// <br>When <code>minimumNrMatchers</code> is bigger than
		/// the number of <code>subScorers</code>,
		/// no matches will be produced.
		/// <br>When minimumNrMatchers equals the number of subScorers,
		/// it more efficient to use <code>ConjunctionScorer</code>.
		/// </param>
		public DisjunctionSumScorer(System.Collections.IList subScorers, int minimumNrMatchers) : base(null)
		{
			
			nrScorers = subScorers.Count;
			
			if (minimumNrMatchers <= 0)
			{
				throw new System.ArgumentException("Minimum nr of matchers must be positive");
			}
			if (nrScorers <= 1)
			{
				throw new System.ArgumentException("There must be at least 2 subScorers");
			}
			
			this.minimumNrMatchers = minimumNrMatchers;
			this.subScorers = subScorers;
		}
开发者ID:ArsenShnurkov,项目名称:beagle-1,代码行数:28,代码来源:DisjunctionSumScorer.cs

示例4: GetUserPreferenceChangedList

		static private void GetUserPreferenceChangedList()
		{
			Type oSystemEventsType = typeof(SystemEvents);

			//Using reflection, get the FieldInfo object for the internal collection of handlers
			// we will use this collection to find the handler we want to unhook and remove it.
			// as you can guess by the naming convention it is a private member.
			System.Reflection.FieldInfo oFieldInfo = oSystemEventsType.GetField("_handlers",
								System.Reflection.BindingFlags.Static |
								System.Reflection.BindingFlags.GetField |
								System.Reflection.BindingFlags.FlattenHierarchy |
								System.Reflection.BindingFlags.NonPublic);

			//now, get a reference to the value of this field so that you can manipulate it.
			//pass null to GetValue() because we are working with a static member.
			object oFieldInfoValue = oFieldInfo.GetValue(null);

			//the returned object is of type Dictionary<object, List<SystemEventInvokeInfo>>
			//each of the Lists<> in the Dictionary<> is used to maintain a different event implementation.
			//It may be more efficient to figure out how the UserPreferenceChanged event is keyed here but a quick-and-dirty
			// method is to just scan them all the first time and then cache the List<> object once it's found.

			System.Collections.IDictionary dictFieldInfoValue = oFieldInfoValue as System.Collections.IDictionary;
			foreach (object oEvent in dictFieldInfoValue)
			{
				System.Collections.DictionaryEntry deEvent = (System.Collections.DictionaryEntry)oEvent;
				System.Collections.IList listEventListeners = deEvent.Value as System.Collections.IList;

				//unfortunately, SystemEventInvokeInfo is a private class so we can't declare a reference of that type.
				//we will use object and then use reflection to get what we need...
				List<Delegate> listDelegatesToRemove = new List<Delegate>();

				//we need to take the first item in the list, get it's delegate and check the type...
				if (listEventListeners.Count > 0 && listEventListeners[0] != null)
				{
					Delegate oDelegate = GetDelegateFromSystemEventInvokeInfo(listEventListeners[0]);
					if (oDelegate is UserPreferenceChangedEventHandler)
					{ _UserPreferenceChangedList = listEventListeners; }
				}
				//if we've found the list, no need to continue searching
				if (_UserPreferenceChangedList != null) break;
			}
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:43,代码来源:LeakHelper.cs

示例5: AddChildren

		/// <summary>
		/// Add all elements of kids list as children of this node
		/// </summary>
		/// <param name="kids"></param>
		public void AddChildren(IList kids) 
		{
			for (int i = 0; i < kids.Count; i++) 
			{
				ITree t = (ITree) kids[i];
				AddChild(t);
			}
		}
开发者ID:sebasjm,项目名称:antlr,代码行数:12,代码来源:BaseTree.cs

示例6: FindTreeWizardContextVisitor

 public FindTreeWizardContextVisitor( TreeWizard outer, TreePattern tpattern, IList subtrees )
 {
     _outer = outer;
     _tpattern = tpattern;
     _subtrees = subtrees;
 }
开发者ID:ksmyth,项目名称:antlr,代码行数:6,代码来源:TreeWizard.cs

示例7: ToArray

 protected int[] ToArray(IList a)
 {
     int[] x = new int[a.Count];
     a.CopyTo(x, 0);
     return x;
 }
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:6,代码来源:Profiler.cs

示例8: AddOffCorrectMap

		protected internal virtual void  AddOffCorrectMap(int off, int cumulativeDiff)
		{
			if (pcmList == null)
			{
				pcmList = new System.Collections.ArrayList();
			}
			pcmList.Add(new OffCorrectMap(off, cumulativeDiff));
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:8,代码来源:BaseCharFilter.cs

示例9: AddParameter

		public virtual NeoDatis.Odb.Core.IError AddParameter(object o)
		{
			if (parameters == null)
			{
				parameters = new System.Collections.ArrayList();
			}
			parameters.Add(o != null ? o.ToString() : "null");
			return this;
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:9,代码来源:BTreeError.cs

示例10: AddProfile

		public virtual void AddProfile(NeoDatis.Odb.Test.Update.Nullobject.Profile profile
			)
		{
			if (listProfile == null)
			{
				listProfile = new System.Collections.ArrayList();
			}
			listProfile.Add(profile);
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:9,代码来源:Functions.cs

示例11: Student

		public Student(int age, NeoDatis.Odb.Test.VO.School.Course course, System.DateTime
			 date, string id, string name)
		{
			this.age = age;
			this.course = course;
			firstDate = date;
			this.id = id;
			this.name = name;
			listHistory = new System.Collections.ArrayList();
		}
开发者ID:ekicyou,项目名称:pasta,代码行数:10,代码来源:Student.cs

示例12: find

        public void find(out PasswordInfo mainAsmPassword, out PasswordInfo embedPassword)
        {
            var asmBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("asm"), AssemblyBuilderAccess.Run);
            var moduleBuilder = asmBuilder.DefineDynamicModule("mod");
            var serializedTypes = new SerializedTypes(moduleBuilder);
            var allTypes = serializedTypes.deserialize(serializedData);
            asmTypes = toList(readField(allTypes, "Types"));

            mainAsmPassword = findMainAssemblyPassword();
            embedPassword = findEmbedPassword();
        }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:11,代码来源:PasswordFinder.cs

示例13: Next

		public override Token Next()
		{
			if (cache == null)
			{
				// fill cache lazily
				cache = new System.Collections.ArrayList();
				FillCache();
				iterator = cache.GetEnumerator();
			}
			
			if (!iterator.MoveNext())
			{
				// the cache is exhausted, return null
				return null;
			}
			
			return (Token) iterator.Current;
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:18,代码来源:CachingTokenFilter.cs

示例14: IncrementToken

		public override bool IncrementToken()
		{
			if (cache == null)
			{
				// fill cache lazily
				cache = new System.Collections.ArrayList();
				FillCache();
				iterator = cache.GetEnumerator();
			}
			
			if (!iterator.MoveNext())
			{
				// the cache is exhausted, return false
				return false;
			}
			// Since the TokenFilter can be reset, the tokens need to be preserved as immutable.
			RestoreState((AttributeSource.State) iterator.Current);
			return true;
		}
开发者ID:carrie901,项目名称:mono,代码行数:19,代码来源:CachingTokenFilter.cs

示例15: Next

        public override Token Next(/* in */ Token reusableToken)
        {
            System.Diagnostics.Debug.Assert(reusableToken != null);
            if (cache == null)
            {
                // fill cache lazily
                cache = new System.Collections.ArrayList();
                FillCache(reusableToken);
                iterator = cache.GetEnumerator();
            }

            if (!iterator.MoveNext())
            {
                // the cache is exhausted, return null
                return null;
            }

            Token nextToken = (Token) iterator.Current;
            return (Token) nextToken.Clone();
        }
开发者ID:cqm0609,项目名称:lucene-file-finder,代码行数:20,代码来源:CachingTokenFilter.cs


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