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


C# Generic.Dictionary类代码示例

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


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

示例1: ShowPage

 protected void ShowPage()
 {
     UsersData users = new UsersData(MapPath("."));
     ImagesData images = new ImagesData(MapPath("."));
     var image = new System.Collections.Generic.Dictionary<string, string>();
     if ((string)Request.QueryString["new"] == "true")
     {
         MultiView_Char.SetActiveView(View_NewChar);
         image["imageName"] = "新しい文字";
     }
     else if (Request.QueryString["id"] != null)
     {
         MultiView_Char.SetActiveView(View_ShowChar);
         image = images.FindImageId((string)Request.QueryString["id"]);
         Label_UserName.Text = users.FindUserID(image["userID"])["userName"];
         Image_Char.ImageUrl = string.Format("images/{0}.{1}", image["imageID"], image["imageType"]);
         TextBox_CharName.Text = image["imageName"];
     }
     else
     {
         Response.Redirect("index.aspx");
     }
     if (TextBox_NewCharName.Text == "")
     {
         TextBox_NewCharName.Text = image["imageName"];
     }
     Literal_Title.Text = image["imageName"];
     Literal_HeaderTitle.Text = image["imageName"];
     string userID = (string)Session["userID"];
     Literal_NavTop.Text = PageKits.generateNavTopContent(userID, users.FindUserID(userID)["userName"]);
 }
开发者ID:ne-sachirou,项目名称:yUsin-1,代码行数:31,代码来源:char.aspx.cs

示例2: InitDataDefinitions

		public static void InitDataDefinitions() {
			if (!initCache) {
                imageDictionary = new System.Collections.Generic.Dictionary<string, DefImage>();
                animationDictionary = new System.Collections.Generic.Dictionary<string, DefAnimation>();
				initCache = true;
			}
		}
开发者ID:207h2Flogintvg,项目名称:LGame,代码行数:7,代码来源:LNDataCache.cs

示例3: ToDictionary

 internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(GeometryThiessenAnalystParameters geometryThiessenParams)
 {
     System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>();
     if (geometryThiessenParams.ClipRegion != null)
     {
         dict.Add("clipRegion", ServerGeometry.ToJson(geometryThiessenParams.ClipRegion));
     }
     dict.Add("createResultDataset", geometryThiessenParams.CreateResultDataset.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
     dict.Add("resultDatasetName", geometryThiessenParams.ResultDatasetName.ToString(System.Globalization.CultureInfo.InvariantCulture));
     dict.Add("resultDatasourceName", geometryThiessenParams.ResultDatasourceName.ToString(System.Globalization.CultureInfo.InvariantCulture));
     dict.Add("returnResultRegion", geometryThiessenParams.ReturnResultRegion.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower());
     if (geometryThiessenParams.Points.Count > 0)
     {
         string points_str = "[";
         int count = geometryThiessenParams.Points.Count;
         for (int i = 0; i < count; i++)
         {
             Point2D point = geometryThiessenParams.Points[i];
             var point_str = "{";
             point_str+=String.Format("\"y\":{0},\"x\":{1}", point.Y, point.X);
             point_str += "}";
             points_str += point_str;
             if (i == count - 1)
             {
                 points_str += "]";                    }
             else
             {
                 points_str+=",";
             }
         }
         dict.Add("points", points_str);
     }
     return dict;
 }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:34,代码来源:GeometryThiessenAnalystParameters.cs

示例4: List

 public void List()
 {
     System.Collections.Generic.IDictionary<string, object> uriArguments = new System.Collections.Generic.Dictionary<string, object>();
     var accept = new string[0];
     var contentType = new string[0];
     Call(Verb.GET, "/type/#GET", accept, contentType, uriArguments);
 }
开发者ID:alien-mcl,项目名称:URSA,代码行数:7,代码来源:TypeClient.cs

示例5: 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

示例6: AsDictionary

 public override System.Collections.Generic.IDictionary<string, object> AsDictionary()
 {
     System.Collections.Generic.Dictionary<string, object> result = new System.Collections.Generic.Dictionary<string, object>();
     result["LastAppliedEventId"] = this.LastAppliedEventId;
     result["Value"] = this.Value;
     return result;
 }
开发者ID:Bee-Htcpcp,项目名称:OrleansEventJournal,代码行数:7,代码来源:orleans.codegen.cs

示例7: InitializeObjects

 private void InitializeObjects()
 {
     this._updateDataTimer = new Timer();
     this._updateDataTimer.Interval = this._updateDataInterval;
     this._updateDataTimer.Tick += new System.EventHandler(this._updateDataTimer_Tick);
     this._OldBetListHistory = new Dictionary<string, DateTime>();
 }
开发者ID:nikersch,项目名称:BuonComIbetSbobet3In1Bet,代码行数:7,代码来源:IbetSubEngine.cs

示例8: ToDictionary

        internal static System.Collections.Generic.Dictionary<string, string> ToDictionary(DatasetBufferAnalystParameters datasetBufferParams)
        {
            System.Collections.Generic.Dictionary<string, string> dict = new System.Collections.Generic.Dictionary<string, string>();
            dict.Add("isAttributeRetained", datasetBufferParams.IsAttributeRetained.ToString().ToLower());
            dict.Add("isUnion", datasetBufferParams.IsUnion.ToString().ToLower());

            string dataReturnOption = "{\"dataReturnMode\": \"RECORDSET_ONLY\",\"deleteExistResultDataset\": true,";
            dataReturnOption += string.Format("\"expectCount\":{0}", datasetBufferParams.MaxReturnRecordCount);
            dataReturnOption += "}";
            dict.Add("dataReturnOption", dataReturnOption);

            if (datasetBufferParams.FilterQueryParameter != null)
            {
                dict.Add("filterQueryParameter", FilterParameter.ToJson(datasetBufferParams.FilterQueryParameter));
            }
            else
            {
                dict.Add("filterQueryParameter", FilterParameter.ToJson(new FilterParameter()));
            }

            if (datasetBufferParams.BufferSetting != null)
            {
                dict.Add("bufferAnalystParameter", BufferSetting.ToJson(datasetBufferParams.BufferSetting));
            }
            else
            {
                dict.Add("bufferAnalystParameter", BufferSetting.ToJson(new BufferSetting()));
            }

            return dict;
        }
开发者ID:SuperMap,项目名称:iClient-for-Win8,代码行数:31,代码来源:DatasetBufferAnalystParameters.cs

示例9: Invoke

 public override Task Invoke(IOwinContext ctx)
 {
     var requestMethod = ctx.Request.Method;
     var routeParams = new System.Collections.Generic.Dictionary<string, object>();
     string remainder;
     var path = ctx.Request.Path.Value;
     var match = MatchMethodAndTemplate(ctx, path);
     if (match == null)
     {
         return Next.Invoke(ctx);
     }
     var env = ctx.Environment;
     RouteParams.Merge(env, match.extracted);
     var oldBase = ctx.Request.PathBase;
     var oldPath = ctx.Request.Path;
     ctx.Request.PathBase = new PathString(oldBase + match.pathMatched);
     ctx.Request.Path = new PathString(match.pathRemaining);
     var restore = new Action<Task>(task => restorePaths(ctx, oldBase, oldPath));
     if (options.app != null)
     {
         return options.app.Invoke(env).ContinueWith(restore, TaskContinuationOptions.ExecuteSynchronously);
     }
     else
     {
         return options.branch.Invoke(ctx).ContinueWith(restore, TaskContinuationOptions.ExecuteSynchronously);
     }
 }
开发者ID:Xamarui,项目名称:OwinUtils,代码行数:27,代码来源:RouteMiddleware.cs

示例10: 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

示例11: ToRelative

        public string ToRelative(string DateString)
        {
            DateTime theDate = Convert.ToDateTime(DateString);
            System.Collections.Generic.Dictionary<long, string> thresholds = new System.Collections.Generic.Dictionary<long, string>();
            int minute = 60;
            int hour = 60 * minute;
            int day = 24 * hour;
            thresholds.Add(60, "{0} seconds ago");
            thresholds.Add(minute * 2, "a minute ago");
            thresholds.Add(45 * minute, "{0} minutes ago");
            thresholds.Add(120 * minute, "an hour ago");
            thresholds.Add(day, "{0} hours ago");
            thresholds.Add(day * 2, "yesterday");
            // thresholds.Add(day * 30, "{0} days ago");
            thresholds.Add(day * 365, "{0} days ago");
            thresholds.Add(long.MaxValue, "{0} years ago");

            long since = (DateTime.Now.Ticks - theDate.Ticks) / 10000000;
            foreach (long threshold in thresholds.Keys)
            {
                if (since < threshold)
                {
                    TimeSpan t = new TimeSpan((DateTime.Now.Ticks - theDate.Ticks));
                    return string.Format(thresholds[threshold], (t.Days > 365 ? t.Days / 365 : (t.Days > 0 ? t.Days : (t.Hours > 0 ? t.Hours : (t.Minutes > 0 ? t.Minutes : (t.Seconds > 0 ? t.Seconds : 0))))).ToString());
                }
            }
            return "";
        }
开发者ID:ArupAus,项目名称:issue-tracker,代码行数:28,代码来源:RelativeDate.cs

示例12: constructor

	static public int constructor(IntPtr l) {
		try {
			int argc = LuaDLL.lua_gettop(l);
			System.Collections.Generic.Dictionary<System.Int32,System.String> o;
			if(argc==1){
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>();
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IEqualityComparer<System.Int32>))){
				System.Collections.Generic.IEqualityComparer<System.Int32> a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IDictionary<System.Int32,System.String>))){
				System.Collections.Generic.IDictionary<System.Int32,System.String> a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(int))){
				System.Int32 a1;
				checkType(l,2,out a1);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(IDictionary<System.Int32,System.String>),typeof(IEqualityComparer<System.Int32>))){
				System.Collections.Generic.IDictionary<System.Int32,System.String> a1;
				checkType(l,2,out a1);
				System.Collections.Generic.IEqualityComparer<System.Int32> a2;
				checkType(l,3,out a2);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1,a2);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			else if(matchType(l,argc,2,typeof(int),typeof(IEqualityComparer<System.Int32>))){
				System.Int32 a1;
				checkType(l,2,out a1);
				System.Collections.Generic.IEqualityComparer<System.Int32> a2;
				checkType(l,3,out a2);
				o=new System.Collections.Generic.Dictionary<System.Int32,System.String>(a1,a2);
				pushValue(l,true);
				pushValue(l,o);
				return 2;
			}
			return error(l,"New object failed.");
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
开发者ID:xclouder,项目名称:godbattle,代码行数:60,代码来源:Lua_System_Collections_Generic_Dictionary_2_int_string.cs

示例13: XMLTokener

		static XMLTokener()
		{
			/*
			Copyright (c) 2002 JSON.org
			
			Permission is hereby granted, free of charge, to any person obtaining a copy
			of this software and associated documentation files (the "Software"), to deal
			in the Software without restriction, including without limitation the rights
			to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
			copies of the Software, and to permit persons to whom the Software is
			furnished to do so, subject to the following conditions:
			
			The above copyright notice and this permission notice shall be included in all
			copies or substantial portions of the Software.
			
			The Software shall be used for Good, not Evil.
			
			THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
			IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
			FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
			AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
			LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
			OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
			SOFTWARE.
			*/
			entity = new System.Collections.Generic.Dictionary<string, char>(8);
			entity["amp"] = org.json.XML.AMP;
			entity["apos"] = org.json.XML.APOS;
			entity["gt"] = org.json.XML.GT;
			entity["lt"] = org.json.XML.LT;
			entity["quot"] = org.json.XML.QUOT;
		}
开发者ID:davidraleigh,项目名称:geometry-api-cs-tests,代码行数:32,代码来源:XMLTokener.cs

示例14: saveInitialPositions

 private void saveInitialPositions()
 {
     initialPositions = new System.Collections.Generic.Dictionary<int, Vector3>();
     foreach(GameObject obj in GameObject.FindGameObjectsWithTag("respawn")) {
         initialPositions.Add(obj.GetInstanceID(), obj.rigidbody.position);
     }
 }
开发者ID:Janin-K,项目名称:SG,代码行数:7,代码来源:GameControl.cs

示例15: LSTRFont

 public LSTRFont(LFont font, bool anti, char[] additionalChars)
 {
     if (displays == null)
     {
         displays = new System.Collections.Generic.Dictionary<string, Loon.Core.Graphics.Opengl.LTextureBatch.GLCache>(totalCharSet);
     }
     else
     {
         displays.Clear();
     }
     this.useCache = true;
     this.font = font;
     this.fontSize = font.GetSize();
     this.ascent = font.GetAscent();
     this.antiAlias = anti;
     if (antiAlias)
     {
         if (trueFont == null)
         {
             trueFont = LFont.GetTrueFont();
         }
         if (additionalChars != null && additionalChars.Length > (textureWidth / trueFont.GetSize()))
         {
             this.textureWidth *= 2;
             this.textureHeight *= 2;
         }
         this.fontScale = (float)fontSize / (float)trueFont.GetSize();
         this.Make(trueFont, additionalChars);
     }
     else
     {
         this.Make(this.font, additionalChars);
     }
 }
开发者ID:ordanielcmessias,项目名称:LGame,代码行数:34,代码来源:LSTRFont.cs


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