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


C# System.Collections.Generic.Dictionary.ContainsKey方法代码示例

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


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

示例1: getShortestDistance

        //also reference to Algorithm.TreeAndGraph.Floyd and Algorithm.TreeAndGraph.Dijkstra
        public static int getShortestDistance(TreeAndGraph.GraphNode start, TreeAndGraph.GraphNode end)
        {
            System.Collections.Generic.Dictionary<int, System.Collections.Generic.List<TreeAndGraph.GraphNode>> tab
                = new System.Collections.Generic.Dictionary<int, System.Collections.Generic.List<TreeAndGraph.GraphNode>>();
            System.Collections.Generic.List<TreeAndGraph.GraphNode> list = new System.Collections.Generic.List<TreeAndGraph.GraphNode>();
            int count = 1;
            list.Add(start);
            tab.Add(count, list);
            while (true)
            {
                System.Collections.Generic.List<TreeAndGraph.GraphNode> gn_list = tab[count];
                ++count;
                if (!tab.ContainsKey(count))
                {
                    list = new System.Collections.Generic.List<TreeAndGraph.GraphNode>();
                    tab.Add(count, list);
                }
                foreach (TreeAndGraph.GraphNode gn in gn_list)
                {

                    foreach (TreeAndGraph.GraphNode node in gn.Nodes)
                    {
                        if (node == end)
                        {
                            return count;
                        }

                        tab[count].Add(node);
                    }
                }
            }
        }
开发者ID:Sanqiang,项目名称:Algorithm-Win,代码行数:33,代码来源:Q31.cs

示例2: GetSystemData

        public string GetSystemData()
        {
            string str;
            UserInfo user;
            if (IsAuthenticated(out str) && GetUser(out user, ref str))
            {
                str += string.Format(", \"profile\": {{ \"userid\":{0}, \"displayname\":\"{1}\", \"image\":\"{2}\", \"IsSuperuser\":{3} }}, \"contacts\":[",
                    user.UserID, user.DisplayName, user.Image, user.IsSuperuser.ToString().ToLower());
                System.Collections.Generic.Dictionary<int, string> contacts = new System.Collections.Generic.Dictionary<int, string>();
                foreach (ContactInfo info in ContactInfo.GetContacts(user.UserID))
                {
                    UserInfo contactuser = UserInfo.Get(info.ContactID);
                    if (!contacts.ContainsKey(info.GroupID))
                        contacts.Add(info.GroupID, "{ \"groupid\": " + info.GroupID + ", \"groupname\": \"" + info.GroupName + "\", \"users\":[");
                    contacts[info.GroupID] += contactuser.ToJSON() + ",";
                }
                foreach (System.Collections.Generic.KeyValuePair<int, string> g in contacts)
                    str += g.Value.Remove(g.Value.Length - 1) + "] },";

                str = str.Remove(str.Length - 1) + "], \"topics\": [ ";
                foreach (TopicInfo info in TopicInfo.GetByUser(user.UserID))
                    str += string.Format("{{ \"id\":{0}, \"title\":\"{1}\" }},", info.TopicID, info.GetTitle());

                str = str.Remove(str.Length - 1) + "]";
            }
            return str;
        }
开发者ID:rosenkolev,项目名称:Communication-System,代码行数:27,代码来源:WebService.cs

示例3: SetHourData

        private void SetHourData(Models.Student student, ExcelWorksheet worksheet)
        {
            var collector = new System.Collections.Generic.Dictionary<SpreadsheetExport.Key, int>();
            foreach (var b in student.Behaviors) {
                var key = new SpreadsheetExport.Key { DayOfWeek = b.TimeRecorded.DayOfWeek.ToString(), Hour = b.TimeRecorded.Hour };
                if (collector.ContainsKey(key))
                    collector[key] += 1;
                else
                    collector.Add(key, 1);

            }
            foreach (var key in collector.Keys) {
                var value = key.Hour - 2;
                switch (key.DayOfWeek.ToString()) {
                    case "Monday": worksheet.Cells[5, value].Value = collector[key];
                        break;
                    case "Tuesday": worksheet.Cells[6, value].Value = collector[key];
                        break;
                    case "Wednesday": worksheet.Cells[7, value].Value = collector[key];
                        break;
                    case "Thursday": worksheet.Cells[8, value].Value = collector[key];
                        break;
                    case "Friday": worksheet.Cells[9, value].Value = collector[key];
                        break;
                    default:
                        break;
                }
            }
        }
开发者ID:stuffihavemade,项目名称:base_station_code,代码行数:29,代码来源:SpreadsheetExporter.cs

示例4: RemoveDuplicateFromUnsortedList

        public static LinkedList<int> RemoveDuplicateFromUnsortedList(LinkedList<int> linkedList)
        {
            if (linkedList == null)
                throw new ArgumentNullException("linkedList");

            var hash = new System.Collections.Generic.Dictionary<int, bool>();
            LinkedListNode<int> currentNode = linkedList.Root;
            LinkedListNode<int> previous = null;

            while (currentNode != null)
            {
                int data = currentNode.Data;
                if (hash.ContainsKey(data))
                {
                    previous.Next = currentNode.Next;
                }
                else
                {
                    hash.Add(data, true);
                    previous = currentNode;
                }
                currentNode = currentNode.Next;
            }
            return linkedList;
        }
开发者ID:adilmughal,项目名称:Algorithms-and-Programming-Problems,代码行数:25,代码来源:LinkedListProblems.cs

示例5: EditVoid

        public void EditVoid()
        {
            byte[] bytes = new byte[] { 240, 1, 14, 239, 55, 55 };
            MacAddress expected = new MacAddress(bytes);
            var result = new System.Collections.Generic.Dictionary<MacAddress, string> {{expected, "ok"}};

            MacAddress target = new MacAddress(bytes);
            Assert.IsTrue(result.ContainsKey(target));
        }
开发者ID:luqizheng,项目名称:Qi4Net,代码行数:9,代码来源:MacAddressTest.cs

示例6: GetGoRoot

        public static string GetGoRoot()
        {
            System.Collections.Generic.Dictionary<string, string> dict =
                new System.Collections.Generic.Dictionary<string, string>(System.StringComparer.InvariantCultureIgnoreCase);
            dict.Add("COR-W81-101", @"D:\Programme\Go\");

            if (dict.ContainsKey(System.Environment.MachineName))
                return dict[System.Environment.MachineName];

            string goroot = System.Environment.GetEnvironmentVariable("goroot");

            if (!string.IsNullOrEmpty(goroot))
                return goroot;

            throw new System.NotSupportedException("You need to configure the goroot environment variable");
        }
开发者ID:ststeiger,项目名称:GoIDE,代码行数:16,代码来源:WebProcessConfig.cs

示例7: CancelOrderExpr

 public void CancelOrderExpr(string expr)
 {
     try
     {
         System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<int>> dictionary = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<int>>();
         if (!string.IsNullOrWhiteSpace(expr))
         {
             DataView dataView = new DataView(Game.State.OpenOrderView.Table, Game.State.OpenOrderView.RowFilter, "", Game.State.OpenOrderView.RowStateFilter);
             dataView.RowFilter = string.Concat(new string[]
             {
                 "(",
                 dataView.RowFilter,
                 ") AND (",
                 expr,
                 ")"
             });
             foreach (DataRowView dataRowView in dataView)
             {
                 string key = (string)dataRowView["Ticker"];
                 if (!dictionary.ContainsKey(key))
                 {
                     dictionary.Add(key, new System.Collections.Generic.List<int>());
                 }
                 dictionary[key].Add((int)dataRowView["ID"]);
             }
             foreach (System.Collections.Generic.KeyValuePair<string, System.Collections.Generic.List<int>> current in dictionary)
             {
                 try
                 {
                     System.Collections.Generic.KeyValuePair<string, System.Collections.Generic.List<int>> k = current;
                     ServiceManager.Execute(delegate(IClientService p)
                     {
                         p.CancelOrder(k.Key, k.Value.ToArray());
                     });
                 }
                 catch (FaultException)
                 {
                 }
             }
         }
     }
     catch
     {
     }
 }
开发者ID:jinpan,项目名称:Traders_IAP,代码行数:45,代码来源:APIObject.cs

示例8: GetAndSendMedPollData

    private IEnumerator GetAndSendMedPollData()
    {
        //Orbit data
        System.Collections.Generic.Dictionary<string, double> DoubleValues = new System.Collections.Generic.Dictionary<string, double>();
        DoubleValues["o.ApA"] = this.vessel.orbit.ApA;
        DoubleValues["o.PeA"] = this.vessel.orbit.PeA;
        DoubleValues["o.timeToAp"] = this.vessel.orbit.timeToAp;
        DoubleValues["o.timeToPe"] = this.vessel.orbit.timeToPe;
        DoubleValues["o.inclination"] = this.vessel.orbit.inclination;
        DoubleValues["o.eccentricity"] = this.vessel.orbit.eccentricity;
        //Resource data
        System.Collections.Generic.Dictionary<string, double> ResourceCurrent = new System.Collections.Generic.Dictionary<string, double>();
        System.Collections.Generic.Dictionary<string, double> ResourceMax = new System.Collections.Generic.Dictionary<string, double>();

        DoubleValues ["v.overheatRatio"] = 0.0d;

        foreach (Part part in this.vessel.parts) {
            //resources
            if (part.Resources.Count > 0) {
                foreach (PartResource partResource in part.Resources) {
                    if (!ResourceCurrent.ContainsKey(partResource.resourceName)) { ResourceCurrent [partResource.resourceName] = 0; }
                    if (!ResourceMax.ContainsKey(partResource.resourceName))     { ResourceMax     [partResource.resourceName] = 0; }
                    ResourceCurrent [partResource.resourceName] += partResource.amount;
                    ResourceMax     [partResource.resourceName] += partResource.maxAmount;
                }
            }
            //overheat
            foreach (PartModule pm in part.Modules) {
                if (!pm.isEnabled) { continue; }
                var thatEngineModule = pm as ModuleEngines;
                var thatEngineModuleFX = pm as ModuleEnginesFX;
                if (thatEngineModule != null || thatEngineModuleFX != null) {
                    double thistempratio = part.temperature / part.maxTemp;
                    DoubleValues ["v.overheatRatio"] = (thistempratio > DoubleValues ["v.overheatRatio"]) ? thistempratio : DoubleValues ["v.overheatRatio"];
                }
            }
        }
        DoubleValues ["v.overheat"] = 0.0;
        foreach (Part thatPart in this.vessel.parts) {

        }
        //POST DATA
        var form = new WWWForm();
        form.AddField("type", "med");
        form.AddField("time", UnixTimeAsString());
        foreach (System.Collections.Generic.KeyValuePair<string, double> entry in DoubleValues)
        {
            form.AddField(entry.Key,entry.Value.ToString());
        }
        foreach (System.Collections.Generic.KeyValuePair<string, double> entry in ResourceCurrent)
        {
            form.AddField("r.resource["+entry.Key+"]", ResourceCurrent[entry.Key].ToString());
        }
        foreach (System.Collections.Generic.KeyValuePair<string, double> entry in ResourceMax)
        {
            form.AddField("r.resourceMax["+entry.Key+"]", ResourceMax[entry.Key].ToString());
        }
        var post = new WWW(postlocation,form);
        yield return post;
        if (!string.IsNullOrEmpty(post.error))
            print("GetAndSendMedPollData: WWWFORM ERROR:" + post.error);
        else
            print("GetAndSendMedPollData: WWWFORM: Finished Uploading Data");
        next_med_poll_time = Time.time + med_freq;
    }
开发者ID:jmorganc,项目名称:GoAtThrottleUp,代码行数:65,代码来源:GoAtThrottleUpAntenna.cs

示例9: DetermineVersion

 private static SQLCEVersion DetermineVersion(string filename)
 {
     var versionDictionary = new System.Collections.Generic.Dictionary<int, SQLCEVersion> 
 { 
     { 0x73616261, SQLCEVersion.SQLCE20 }, 
     { 0x002dd714, SQLCEVersion.SQLCE30},
     { 0x00357b9d, SQLCEVersion.SQLCE35},
     { 0x003d0900, SQLCEVersion.SQLCE40}
 };
     int versionLONGWORD = 0;
     try
     {
         using (var fs = new System.IO.FileStream(filename, System.IO.FileMode.Open))
         {
             fs.Seek(16, System.IO.SeekOrigin.Begin);
             using (System.IO.BinaryReader reader = new System.IO.BinaryReader(fs))
             {
                 versionLONGWORD = reader.ReadInt32();
             }
         }
     }
     catch
     {
         throw;
     }
     if (versionDictionary.ContainsKey(versionLONGWORD))
     {
         return versionDictionary[versionLONGWORD];
     }
     else
     {
         throw new ApplicationException("Unable to determine database file version");
     }
 }
开发者ID:herohut,项目名称:elab,代码行数:34,代码来源:SqlCeHelper.cs

示例10: GetCAMLQueryForWellBookPages

 /// <summary>
 /// Gets the CAML query for well book pages.
 /// </summary>
 /// <returns>CAML query for well book pages.</returns>
 private string GetCAMLQueryForWellBookPages()
 {
     string strCamlQuery = string.Empty;
     StringBuilder sbChapterId = new StringBuilder();
     DataTable dtListDetails = null;
     string strTerminated = string.Empty;
     if (!ActiveStatus)
         strTerminated = STATUS_TERMINATED;
     else
         strTerminated = STATUS_ACTIVE;
     string strBookId = HttpContext.Current.Request.QueryString["BookId"];
     if (string.IsNullOrEmpty(strBookId))
         return string.Empty;
     objCommonBLL = new CommonBLL();
     strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" +
      strBookId + "</Value></Eq></Where>";
     dtListDetails = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCamlQuery);
     if (dtListDetails != null && dtListDetails.Rows.Count > 0)
     {
         dicChatperDetail = new System.Collections.Generic.Dictionary<string, string>();
         for (int intRowIndex = 0; intRowIndex < dtListDetails.Rows.Count; intRowIndex++)
         {
             if (!dicChatperDetail.ContainsKey(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"])))
             {
                 dicChatperDetail.Add(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]), Convert.ToString(dtListDetails.Rows[intRowIndex]["Title"]));
                 sbChapterId.Append(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]));
                 sbChapterId.Append(";");
             }
         }
         strCamlQuery = CreateCAMLQueryForSetOfCondtion(sbChapterId.ToString(), "Chapter_ID", "Number");
         sbChapterId.Remove(0, sbChapterId.Length);
         sbChapterId.Append(strCamlQuery);
         sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>");
         sbChapterId.Insert(0, "<Where><And>");
         sbChapterId.Insert(0, "<OrderBy><FieldRef Name='Page_Name' /></OrderBy>");
     }
     if (dtListDetails != null)
     {
         dtListDetails.Dispose();
     }
     return sbChapterId.ToString();
 }
开发者ID:vijaymca,项目名称:Dotnet,代码行数:46,代码来源:CustomListViewerHelper.cs

示例11: Child_Update

        /// <summary>
        /// Updates the child object.
        /// </summary>
        /// <param name="parameters">The parameters collection may contain more parameters than needed based on the context it was called. We need to filter this list.</param>
        protected override void Child_Update(params object[] parameters)
        {
            bool cancel = false;
            OnUpdating(ref cancel);
            if (cancel) return;

            // We require that one of the parameters be a connection so we can do the CRUD operations.
            var connection = parameters.OfType<SqlConnection>().FirstOrDefault();
            if (connection == null)
                throw new ArgumentNullException("parameters", "Must contain a SqlConnection parameter.");

            RaiseListChangedEvents = false;

            foreach (var item in DeletedList)
            {
                DataPortal.UpdateChild(item, connection);
            }

            DeletedList.Clear();
            
            // Trim down the list to what is actually contained in the child class.
            var list = new System.Collections.Generic.Dictionary<string, object>() {};
            foreach (object o in parameters)
            {
                if(o == null) continue;

                var key = o.GetType().ToString();
                if (!list.ContainsKey(key))
                    list.Add(key, o);
            }

            foreach (var item in Items)
            {
                DataPortal.UpdateChild(item, list.Values.ToArray());
            }

            RaiseListChangedEvents = true;

            OnUpdated();
        }
开发者ID:codesmithtools,项目名称:Framework-Samples,代码行数:44,代码来源:ItemList.DataAccess.cs

示例12: MergeXml

        private static void MergeXml(XmlDocument d1, XmlNode n1, string xpath1, XmlDocument d2, XmlNode n2, string xpath2)
        {
            System.Collections.Generic.Dictionary<string, XmlNode> ch1nodes = new System.Collections.Generic.Dictionary<string,XmlNode>();
            foreach (XmlNode ch1 in n1.ChildNodes)
            {
                ch1nodes[GetXmlNodeKey(ch1)] = ch1;
            }

            foreach (XmlNode ch2 in n2.ChildNodes)
            {
                string ch2Key = GetXmlNodeKey(ch2);

                XmlNode ch1 = null;
                if (ch1nodes.ContainsKey(ch2Key))
                {
                    ch1 = ch1nodes[ch2Key];

                    if (ch2.Attributes["n"] != null && ch1.Attributes["n"] == null)
                        ch1.Attributes.Append(ch2.Attributes["n"].Clone() as XmlAttribute);

                    else if (ch2.Attributes["v"] != null && ch1.Attributes["v"] == null)
                        ch1.Attributes.Append(ch2.Attributes["v"].Clone() as XmlAttribute);

                    if (ch2.HasChildNodes)
                    {
                        MergeXml(d1, ch1, xpath1 + ch2Key, d2, ch2, xpath2 + ch2Key);
                    }
                }
                else 
                {
                    //ch1 = ch2.CloneNode(true);
                    ch1 = d1.ImportNode(ch2, true);
                    n1.AppendChild(ch1);
                }
            }
        }
开发者ID:nguyenhuuhuy,项目名称:mygeneration,代码行数:36,代码来源:dbRoot.cs

示例13: ReadAllData

        public System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> ReadAllData(int titleLine)
        {
            System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> csvReaderData = new System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>>();
            System.Collections.Generic.List<string[]> csvReaderRow = this.ReadAllRow();
            string[] titles = csvReaderRow[titleLine];
            for (int i = titleLine + 1; i < csvReaderRow.Count; i++)
            {

                System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>();
                for (int ii = 0; ii < titles.Length; ii++)
                {

                    try
                    {
                        if (dic.ContainsKey(titles[ii].Trim()))
                        {
                            for (int k = 0; k < 1000; k++)
                            {
                                if (!dic.ContainsKey(titles[ii].Trim() + k))
                                {
                                    dic.Add(titles[ii].Trim() + k, csvReaderRow[i][ii]);
                                    break;
                                }
                            }
                        }
                        else
                        {
                            if (csvReaderRow[i].Length > ii)
                            {
                                dic.Add(titles[ii].Trim(), csvReaderRow[i][ii]);
                            }
                        }
                    }
                    catch (Exception)
                    {

                        throw;
                    }
                }
                csvReaderData.Add(dic);
            }
            return csvReaderData;
        }
开发者ID:276398084,项目名称:KW.OrderManagerSystem,代码行数:43,代码来源:CsvReader.cs

示例14: GetPayload

		// TODO: Remove warning after API has been finalized
		/// <summary> WARNING: The List is not necessarily in order of the the positions</summary>
		/// <returns> Collection of <code>byte[]</code> payloads
		/// </returns>
		/// <throws>  IOException </throws>
		public override System.Collections.Generic.ICollection<byte[]> GetPayload()
		{
            //mgarski: faking out another HashSet<T>...
			System.Collections.Generic.Dictionary<byte[], byte[]> matchPayload = new System.Collections.Generic.Dictionary<byte[], byte[]>(); 
			for (SpansCell cell = first; cell != null; cell = cell.next)
			{
				if (cell.IsPayloadAvailable())
				{
                    System.Collections.Generic.ICollection<byte[]> cellPayload = cell.GetPayload();
                    foreach (byte[] val in cellPayload)
                    {
                        if (!matchPayload.ContainsKey(val))
                        {
                            matchPayload.Add(val, val);
                        }
                    }
				}
			}
			return matchPayload.Keys;
		}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:25,代码来源:NearSpansUnordered.cs

示例15: ExportCsv

        void ExportCsv(string in_path, System.Collections.Generic.IEnumerable<Google.GData.Spreadsheets.WorksheetEntry> in_entries, bool in_bSanitize)
        {
            ShowNotification(new GUIContent("Saving to: " + in_path));
            Debug.Log("Saving to: " + in_path);

            // System.Collections.Generic.Dictionary< String Key, System.Collections.Generic.Dictionary< Language, String Value > >
            var allRows = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.Dictionary<string, string>>();
            var colHeaders = new System.Collections.Generic.List<string>();
            // for each page


            foreach (var listFeed in in_entries.Select(in_entry => in_entry.Links.FindService(Google.GData.Spreadsheets.GDataSpreadsheetsNameTable.ListRel, null)).Select(in_listFeedLink => new Google.GData.Spreadsheets.ListQuery(in_listFeedLink.HRef.ToString())).Select(in_listQuery => _Service.Query(in_listQuery)).Where(in_listFeed => in_listFeed.Entries.Count > 0))
            {
                var curCol = 0;
                // Iterate through each row, printing its cell values.
                foreach (var atomEntry in listFeed.Entries)
                {
                    var row = (Google.GData.Spreadsheets.ListEntry)atomEntry;
                    // Don't process rows marked for _Ignore
                    if (GfuStrCmp(row.Title.Text, "VOID"))
                    {
                        continue;
                    }

                    // Iterate over the columns, and print each cell value
                    foreach (Google.GData.Spreadsheets.ListEntry.Custom element in row.Elements)
                    {
                        // Don't process columns marked for _Ignore
                        if (GfuStrCmp(element.LocalName, "VOID"))
                        {
                            curCol++;
                            continue;
                        }

                        if (curCol > 0)
                        {
                            if (!allRows.ContainsKey(row.Title.Text))
                                allRows.Add(row.Title.Text, new System.Collections.Generic.Dictionary<string, string>());
                            allRows[row.Title.Text].Add(element.LocalName, element.Value);

                            // Maintain a single list of available column headers, we will use this to
                            // iterate the columns later
                            if (!colHeaders.Contains(element.LocalName))
                                colHeaders.Add(element.LocalName);
                        }
                        curCol++;
                    }

                    curCol = 0;
                }
            }

            var fs = System.IO.File.Open(in_path, System.IO.File.Exists(in_path) ? System.IO.FileMode.Truncate : System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);

            var sw = new System.IO.StreamWriter(fs);
            string fileString = "KEY,";

            foreach (var colHeader in colHeaders)
            {
                fileString += colHeader;
                if (colHeader != colHeaders[colHeaders.Count - 1])
                    fileString += ",";
            }
            fileString += System.Environment.NewLine;

            foreach (var curRow in allRows)
            {

                fileString += curRow.Key + ",";
                System.Collections.Generic.Dictionary<string, string> rowValue = curRow.Value;

                foreach (string colHeader in colHeaders)
                {
                    if (rowValue.ContainsKey(colHeader))
                    {
                        if (in_bSanitize)
                            fileString += SanitizeDf(rowValue[colHeader]);
                        else
                            fileString += rowValue[colHeader];
                    }
                    if (colHeader != colHeaders[colHeaders.Count - 1])
                        fileString += ",";
                }
                fileString += System.Environment.NewLine;
            }

            sw.Write(fileString);
            sw.Close();

            fs.Close();
        }
开发者ID:cupsster,项目名称:gtmanager,代码行数:91,代码来源:GoogleFu.cs


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