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


C# Dictionary.add方法代码示例

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


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

示例1: getDictionary_byType

		public static Dictionary<string,List<ConstantPool>> getDictionary_byType(this  List<ConstantPool> constantsPool, Java_Method method)		
		{
			var usedInMethod = method.uniqueTargetIndexes();
			//show.info(usedInMethod);
			var mappedByIndex = constantsPool.getDictionary_byIndex();
			//show.info(mappedByIndex); 
			var dictionary = new Dictionary<string,List<ConstantPool>>();
			foreach(var index in usedInMethod)
			{
				if (mappedByIndex.hasKey(index))
				{
					var constantPool = mappedByIndex[index];
					dictionary.add(constantPool.Type, constantPool);
				}
			}
			return dictionary;
		}					
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:17,代码来源:API_IKVMC.cs

示例2: getConstantsPoolUsage_byIndex_WithLineNumbers

		public static Dictionary<int,List<Java_Instruction>> getConstantsPoolUsage_byIndex_WithLineNumbers(this Java_Method method)
		{
			var dictionary = new Dictionary<int,List<Java_Instruction>>(); 
			foreach(var instruction in method.Instructions)	 						
				if(instruction.Target_Index >0)
				dictionary.add(instruction.Target_Index, instruction);			
			return dictionary;
		} 
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:8,代码来源:API_IKVMC.cs

示例3: getConstantPoolEntries

		public static List<ConstantPool> getConstantPoolEntries(this object classFile)
		{
			var constantsPool = new List<ConstantPool>();
			
			var constantPoolRaw = new Dictionary<int,object>();
			var constantPool =  (IEnumerable)classFile.field("constantpool");  
			if (constantPool.isNull())
				"in getConstantPoolEntries , classFile.field(\"constantpool\") was null".error();
			else
			{;
				var index = 0;
				foreach(var constant in constantPool)
					constantPoolRaw.add(index++, constant); 
				
			//var constantPoolValues = new Dictionary<int,string>();	 
		//	var stillToMap = new List<object>();
				for(int i=0; i < constantPoolRaw.size() ; i++)
				{
					var currentItem = constantPoolRaw[i];
					var currentItemType = currentItem.str();
					switch(currentItemType)
					{
						case "IKVM.Internal.ClassFile+ConstantPoolItemClass":											
							constantsPool.add_Entry(i, currentItemType.remove("IKVM.Internal.ClassFile+ConstantPoolItem"), currentItem.prop("Name").str());						
							break;
						case "IKVM.Internal.ClassFile+ConstantPoolItemMethodref":											
							constantsPool.add_Entry(i,currentItemType.remove("IKVM.Internal.ClassFile+ConstantPoolItem"), 
													"{0}.{1}{2}".format(currentItem.prop("Class"),
													   	 				   currentItem.prop("Name"),
													   	 				   currentItem.prop("Signature")));									
							break;												   	 				   
						case "IKVM.Internal.ClassFile+ConstantPoolItemInterfaceMethodref": 
							constantsPool.add_Entry(i,currentItemType.remove("IKVM.Internal.ClassFile+ConstantPoolItem"),
													"{0}.{1}{2}".format(currentItem.prop("Class"),
													   	 				   currentItem.prop("Name"),
													   	 				   currentItem.prop("Signature")));									
							break;	
						case "IKVM.Internal.ClassFile+ConstantPoolItemFieldref":																		
							constantsPool.add_Entry(i,currentItemType.remove("IKVM.Internal.ClassFile+ConstantPoolItem"), 
													"{0}.{1} : {2}".format(currentItem.prop("Class"),
													   	 				   currentItem.prop("Name"),
													   	 				   currentItem.prop("Signature")));									
							break;
						case "IKVM.Internal.ClassFile+ConstantPoolItemNameAndType":	 // skip this one since don;t know what they point to
							//constantPoolValues.Add(i,"IKVM.Internal.ClassFile+ConstantPoolItemNameAndType");	
							break; 
						case "IKVM.Internal.ClassFile+ConstantPoolItemString":
						case "IKVM.Internal.ClassFile+ConstantPoolItemInteger":
						case "IKVM.Internal.ClassFile+ConstantPoolItemFloat":
						case "IKVM.Internal.ClassFile+ConstantPoolItemDouble": 
						case "IKVM.Internal.ClassFile+ConstantPoolItemLong":
							var value = currentItem.prop("Value").str();
							value = value.base64Encode();//HACK to deal with BUG in .NET Serialization and Deserialization (to reseatch further)
							constantsPool.add_Entry(i,currentItemType.remove("IKVM.Internal.ClassFile+ConstantPoolItem"),value, true);
							break;					
						case "[null value]":
							//constantsPool.add_Entry(i,"[null value]", null);						
							break; 
						default:
							"Unsupported constantPoll type: {0}".error(currentItem.str());
							break;
					}		
				}
			}
			return constantsPool;	
		}		
开发者ID:CallMeSteve,项目名称:O2.Platform.Scripts,代码行数:66,代码来源:API_IKVMC.cs


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