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


C# Hashtable.GetEnumerator方法代码示例

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


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

示例1: GetEnumerator

        public IDictionaryEnumerator GetEnumerator(string typeName)
        {
            if (_cache == null)
                return null;

            //if (typeName == null)
            if (typeName == "*")
                return GetEnumerator();
            else
            {
                IDictionaryEnumerator en = _cache.GetEnumerator() as IDictionaryEnumerator;
                Hashtable tbl = new Hashtable();

                while (en.MoveNext())
                {
                    object obj = ((CacheEntry)en.Value).DeflattedValue(_cache.Context.CacheImpl.Name);

                    if (obj.GetType().FullName == typeName)
                    {
                        tbl[en.Key] = en.Value;
                    }
                }

                return tbl.GetEnumerator();
            }
        }
开发者ID:javithalion,项目名称:NCache,代码行数:26,代码来源:VirtualQueryIndex.cs

示例2: ApplyPropertyValues

 internal static void ApplyPropertyValues(MobileControl mobileControl, Hashtable overrides)
 {
     if ((mobileControl != null) && (overrides != null))
     {
         IDictionaryEnumerator enumerator = overrides.GetEnumerator();
         while (enumerator.MoveNext())
         {
             int num;
             string str2;
             object obj2 = mobileControl;
             string key = (string) enumerator.Key;
             object obj3 = enumerator.Value;
             if (!(key.ToLower() == "id"))
             {
                 goto Label_006A;
             }
             continue;
         Label_0039:
             str2 = key.Substring(0, num);
             obj2 = obj2.GetType().GetProperty(str2, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase).GetValue(obj2, null);
             key = key.Substring(num + 1);
         Label_006A:
             if ((num = key.IndexOf("-")) != -1)
             {
                 goto Label_0039;
             }
             FindAndApplyPropertyValue(obj2, key, obj3);
         }
     }
 }
开发者ID:ikvm,项目名称:webmatrix,代码行数:30,代码来源:Utils.cs

示例3: Parse

		public static void Parse(
			XmlDocument		xmlMetadata_in, 
			string			xsltTemplateURL_in, 
			Hashtable		xsltParameters_in, 

			StringWriter	parsedOutput_in
		) {
			#region XsltArgumentList _xsltparameters = new XsltArgumentList().AddParam(...);
			XsltArgumentList _xsltparameters = new XsltArgumentList();
			IDictionaryEnumerator _denum = xsltParameters_in.GetEnumerator();
			_denum.Reset();
			while (_denum.MoveNext()) {
				_xsltparameters.AddParam(
					_denum.Key.ToString(), 
					"", 
					System.Web.HttpUtility.UrlEncode(
						_denum.Value.ToString()
					)
				);
			}
			#endregion

			XPathNavigator _xpathnav = xmlMetadata_in.CreateNavigator();
			XslTransform _xslttransform = new XslTransform();
			_xslttransform.Load(
				xsltTemplateURL_in
			);
			_xslttransform.Transform(
				_xpathnav, 
				_xsltparameters, 
				parsedOutput_in, 
				null
			);
		}
开发者ID:katshann,项目名称:ogen,代码行数:34,代码来源:ParserXSLT.cs

示例4: Concat

 /// <summary>
 /// 合并数组
 /// </summary>
 /// <param name="ids">数组</param>
 /// <returns>数组</returns>
 public static string[] Concat(params string[][] ids)
 {
     // 进行合并
     Hashtable hashValues = new Hashtable();
     if (ids != null)
     {
         for (int i = 0; i < ids.Length; i++)
         {
             if (ids[i] != null)
             {
                 for (int j = 0; j < ids[i].Length; j++)
                 {
                     if (ids[i][j] != null)
                     {
                         if (!hashValues.ContainsKey(ids[i][j]))
                         {
                             hashValues.Add(ids[i][j], ids[i][j]);
                         }
                     }
                 }
             }
         }
     }
     // 返回合并结果
     string[] returnValues = new string[hashValues.Count];
     IDictionaryEnumerator enumerator = hashValues.GetEnumerator();
     int key = 0;
     while (enumerator.MoveNext())
     {
         returnValues[key] = (string)(enumerator.Key.ToString());
         key++;
     }
     return returnValues;
 }
开发者ID:huoxudong125,项目名称:DotNet,代码行数:39,代码来源:StringUtil.cs

示例5: DoUpdate

 public int DoUpdate(string Tbl, Hashtable HS, string strcondition)
 {
     IDictionaryEnumerator myEnumerator = HS.GetEnumerator();
     System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
     cmd.Connection = objCon;
     string qry = null;
     int Rcnt = 0;
     string strLst = "";
     while (myEnumerator.MoveNext())
     {
         strLst += myEnumerator.Key + "[email protected]" + myEnumerator.Key + ",";
         //cmd.Parameters.Add("@" & myEnumerator.Key, CStr(myEnumerator.Value))
         cmd.Parameters.AddWithValue("@" + myEnumerator.Key, Convert.ToString(myEnumerator.Value));
     }
     char quto = ',';
     strLst = strLst.Trim().TrimEnd(quto);
     //strLst = strLst.Trim().TrimEnd(",");
     qry = "Update " + Tbl + " set  " + strLst + " where " + strcondition;
     cmd.CommandText = qry;
     if (objCon.State == ConnectionState.Closed)
         objCon.Open();
     Rcnt = cmd.ExecuteNonQuery();
     if (objCon.State == ConnectionState.Open)
         objCon.Close();
     return Rcnt;
 }
开发者ID:manivts,项目名称:impexcubeapp,代码行数:26,代码来源:ClassSQL.cs

示例6: DumpHash

 internal static void DumpHash(string tag, Hashtable hashTable)
 {
     IDictionaryEnumerator enumerator = hashTable.GetEnumerator();
     while (enumerator.MoveNext())
     {
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:SoapUtil.cs

示例7: checkResults

        public static bool checkResults( string procedure, Hashtable param )
        {
            SqlConnection conn = new SqlConnection(OrionGlobals.getConnectionString("connectionString"));
            SqlCommand cmd = new SqlCommand(procedure, conn);
            cmd.CommandType=CommandType.StoredProcedure;
            cmd.CommandTimeout = 0;

            if( param != null ) {
                IDictionaryEnumerator iter = param.GetEnumerator();
                while( iter.MoveNext() )
                    cmd.Parameters.Add( (string)iter.Key, iter.Value );
            }

            try {

                conn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                return dr.HasRows;

            } catch( SqlException e ) {
                throw new AlnitakException(String.Format("Excepcao a correr o SP '{0}' @ SqlServerUtility::checkResults - {1}",procedure,e.Message),e);
            } finally {
                conn.Close();
            }
        }
开发者ID:zi-yu,项目名称:orionsbelt,代码行数:25,代码来源:SqlServerUtility.cs

示例8: DoInsert

        public int DoInsert(string Tbl, Hashtable HS)
        {
            IDictionaryEnumerator myEnumerator = HS.GetEnumerator();
            System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
            cmd.Connection = objCon;
            string qry = null;
            int Rcnt = 0;
            string colLst = "";
            string valLst = "";
            while (myEnumerator.MoveNext())
            {
                colLst += myEnumerator.Key + ",";
                valLst += "@" + myEnumerator.Key + ",";
                cmd.Parameters.AddWithValue("@" + myEnumerator.Key, Convert.ToString(myEnumerator.Value));

            }
            char qut = ',';

            colLst = colLst.Trim().TrimEnd(qut);
            valLst = valLst.Trim().TrimEnd(qut);
             qry = "insert into " + Tbl + " ( " + colLst + " ) values ( " + valLst + " ) ";
            cmd.CommandText = qry;
            if (objCon.State == ConnectionState.Closed)
                objCon.Open();
            Rcnt = cmd.ExecuteNonQuery();
            if (objCon.State == ConnectionState.Open)
                objCon.Close();
            return Rcnt;
        }
开发者ID:manivts,项目名称:impexcubeapp,代码行数:29,代码来源:ClassSQL.cs

示例9: FillUpDropDown

        /// <summary>
        /// Populate dropdownlist
        /// </summary>
        /// <returns></returns>
        public static void FillUpDropDown(DropDownList ddl, Hashtable ht, string defaultselectedvalue)
        {
            string strText, strValue;

            IDictionaryEnumerator ie = ht.GetEnumerator();

            while (ie.MoveNext())
            {
                ddl.Items.Add(new ListItem(ie.Value.ToString(), ie.Key.ToString()));
            }

            if (!string.IsNullOrEmpty(defaultselectedvalue))
                ddl.Items.Insert(0, new ListItem(defaultselectedvalue, "0"));

            //Loop through the items, asign text and value, and sort by text ascending.
            for (int i = ddl.Items.Count - 1; i > 0; i--)
                for (int j = 1; j < i; j++)
                {
                    if (ddl.Items[j].Text.CompareTo(ddl.Items[j + 1].Text) > 0)
                    {
                        strText = ddl.Items[j].Text;
                        strValue = ddl.Items[j].Value;
                        ddl.Items[j].Text = ddl.Items[j + 1].Text;
                        ddl.Items[j].Value = ddl.Items[j + 1].Value;
                        ddl.Items[j + 1].Text = strText;
                        ddl.Items[j + 1].Value = strValue;
                    }
                }
        }
开发者ID:mangmaytinh,项目名称:vguitar,代码行数:33,代码来源:DropdownListHelper.cs

示例10: Hashtable

 IDictionaryEnumerator IDictionary.GetEnumerator(){
     var stub = new Hashtable();
     foreach (string o in Session.Keys){
         stub[o] = Session[o];
     }
     return stub.GetEnumerator();
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:7,代码来源:SessionAsDictionary.cs

示例11: AmIOnline

        //公用类中判断用户是否在线的函数(供用户调用)
        /// <summary> 
        /// 判断用户strUserID是否包含在Hashtable h中 
        /// </summary> 
        /// <param name="strUserID"></param> 
        /// <param name="h"></param> 
        /// <returns></returns> 
        public static bool AmIOnline(string strUserID, Hashtable h)
        {
            if (strUserID == null)
            {
                return false;
            }

            //继续判断是否该用户已经登陆
            if (h == null)
            {
                return false;
            }

            //判断哈希表中是否有该用户
            IDictionaryEnumerator e1 = h.GetEnumerator();
            bool flag = false;
            while (e1.MoveNext())
            {
                if (e1.Value.ToString().CompareTo(strUserID) == 0)
                {
                    flag = true;
                    break;
                }
            }
            return flag;
        }
开发者ID:1018ji,项目名称:CenterPortal,代码行数:33,代码来源:Login.aspx.cs

示例12: Run

        public static void Run()
        {
            // ExStart:CustomPropertiesUsingMeta
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();

            // Create instance of PdfFileInfo object
            Aspose.Pdf.Facades.PdfFileInfo fInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "inFile1.pdf");

            // Retrieve all existing custom attributes
            System.Collections.Hashtable hTable =  new Hashtable(fInfo.Header);

            IDictionaryEnumerator enumerator = hTable.GetEnumerator();
            while (enumerator.MoveNext())
            {
            string output = enumerator.Key.ToString() + " " + enumerator.Value;
            }

            // Set new customer attribute as meta info
            fInfo.SetMetaInfo("CustomAttribute", "test value");

            // Get custom attribute from meta info by specifying attribute/property name
            string value = fInfo.GetMetaInfo("CustomAttribute");
            // ExEnd:CustomPropertiesUsingMeta                      
        }
开发者ID:aspose-pdf,项目名称:Aspose.Pdf-for-.NET,代码行数:25,代码来源:CustomPropertiesUsingMeta.cs

示例13: UT_Connectionstring_ParseParameter_auxiliar

		private void UT_Connectionstring_ParseParameter_auxiliar(Hashtable hash_in) {
			string _constring;
			IDictionaryEnumerator _enumerator;

			for (int i = 0; ; i++) {
				if (((eDBServerTypes_supportedForGeneration)i).ToString() == "invalid") {
					break;
				} else if (((eDBServerTypes_supportedForGeneration)i).ToString() == i.ToString()) {
					continue;
				} else {
					_constring = utils.Connectionstring.Buildwith.Parameters(
						(string)hash_in[utils.Connectionstring.eParameter.Server],
						(string)hash_in[utils.Connectionstring.eParameter.User], 
						"somepassword",
						(string)hash_in[utils.Connectionstring.eParameter.Database], 
						(eDBServerTypes)i
					);

					_enumerator = hash_in.GetEnumerator();
					while (_enumerator.MoveNext()) {
						Assert.AreEqual(
//						Console.WriteLine(
//"'{0}'\n'{1}'\n{2}\n",
							(string)_enumerator.Value, 
							utils.Connectionstring.ParseParameter(
								_constring,
								(eDBServerTypes)i,
								(utils.Connectionstring.eParameter)_enumerator.Key
							)
//, _constring
						);
					}
				}
			}
		}
开发者ID:katshann,项目名称:ogen,代码行数:35,代码来源:UT_utils.cs

示例14: PrintIndexAndKeysAndValues

 private void PrintIndexAndKeysAndValues( Hashtable myList )
 {
     IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
     int i = 0;
     RosterLib.Utility.Announce( "\t-INDEX-\t-KEY-\t-VALUE-" );
     while ( myEnumerator.MoveNext() )
         RosterLib.Utility.Announce( string.Format( "\t[{0}]:\t{1}\t{2}", i++, myEnumerator.Key, myEnumerator.Value ) );
 }
开发者ID:Quarterback16,项目名称:GerardGui,代码行数:8,代码来源:TEPMaster.cs

示例15: CreateFileList

        /// <summary>
        /// Main method, which developer-user will call to get a list of
        ///  all of the files loaded into a sent in hashtable list
        /// </summary>
        /// <param name="p_TargetDir">The top-level directory you want to search</param>
        /// <param name="p_FilePattern">The file pattern you want to search, ex. *.*, frs*.old, msen.old</param>
        /// <param name="p_htDirs">Hashtable ref which will hold all of the directories searched</param>
        /// <param name="p_htFiles">Hashtable ref which will be a list of all the files found, which match
        /// the filepattern entered</param>
        /// <param name="p_SearchSubdirs">bool whether or not you want to search the subdirs</param>
        public static void CreateFileList(string p_TargetDir, string p_FilePattern,
            ref Hashtable p_htDirs, ref Hashtable p_htFiles, bool p_SearchSubdirs)
        {
            //CREATE A LIST OF FILES Which will be searched
            //basically get all of the files which match the file pattern
            //from the path the user entered p_TargetDir
            // if the user enters an empty string for the targetdir,
            // the application will get the currentdirectory (app.path) and continue
            string strCurrDir = string.Empty;
            if (p_TargetDir.Length != 0)
            {
                strCurrDir = p_TargetDir;
            }
            else
            {
                strCurrDir = Directory.GetCurrentDirectory();
            }

            try
            {
                // you could get an error when the user enters a bad path
                string[] files = Directory.GetFiles(strCurrDir, p_FilePattern);
                string[] Dirs = Directory.GetDirectories(strCurrDir);
                int DirCount;
                int FileCount;
                // add all subdirectories
                for (DirCount = 0; DirCount < Dirs.Length; DirCount++)
                {
                    p_htDirs.Add(Dirs[DirCount], Dirs[DirCount]);
                }
                // add all files
                for (FileCount = 0; FileCount < files.Length; FileCount++)
                {
                    p_htFiles.Add(files[FileCount], files[FileCount]);
                }

                if (p_SearchSubdirs)
                {
                    // iterate through all of the directories in the current directory
                  System.Collections.IDictionaryEnumerator DirectoryEnum;
                    while (p_htDirs.Count > 0)
                    {
                        DirectoryEnum = p_htDirs.GetEnumerator();
                        DirectoryEnum.MoveNext();
                        // Get all the subdirs of this directory and add them to the directory hashtable
                        IterateDirectories(
                            DirectoryEnum.Key.ToString(), 
                            p_FilePattern,
                            ref p_htDirs, 
                            ref p_htFiles);
                    }
                }
            }
            catch(Exception OpenDirEx)
            {
            }
        }
开发者ID:xs2ranjeet,项目名称:13ns9-1spr,代码行数:67,代码来源:DiscoFiles.cs


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