本文整理汇总了C#中OrderedDictionary类的典型用法代码示例。如果您正苦于以下问题:C# OrderedDictionary类的具体用法?C# OrderedDictionary怎么用?C# OrderedDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrderedDictionary类属于命名空间,在下文中一共展示了OrderedDictionary类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LoadNpcSpawner
private NpcSpawner LoadNpcSpawner(TmxObjectGroup.TmxObject tmxObject, OrderedDictionary<string, IGameObject> gameObjects, ContentManager content)
{
OrderedDictionary<string, Npc> _npcs = new OrderedDictionary<string, Npc>();
var xmlDoc = new XmlDocument();
xmlDoc.Load(tmxObject.Properties["SpawnerFile"]);
XmlNodeList nodes = xmlDoc.SelectNodes("NPCS/NPC");
var spawningEntities = new List<IEntity>();
for (int i = 0; i < nodes.Count; i++)
{
// Load the npcs for the spawner.
string uniqueID = nodes[i].Attributes["UniqueID"].Value;
string npcDataFilePath = nodes[i].Attributes["filepath"].Value;
spawningEntities.Add(Npc.Load(npcDataFilePath, uniqueID, content));
}
var spawnerPosition = new Vector2(tmxObject.X, tmxObject.Y);
var updateInterval = uint.Parse(tmxObject.Properties["UpdateInterval"]);
return new NpcSpawner(spawnerPosition, updateInterval, gameObjects, spawningEntities);
}
开发者ID:JohnLamontagne,项目名称:dominus-engine,代码行数:25,代码来源:MapObjectLoader.cs
示例2: Before
public void Before() {
_random = new Random();
_dict = new OrderedDictionary();
for (int i = 0; i < n; i++) {
_dict.Add(i, new Entity(CP.NumComponents, null));
}
}
开发者ID:ChicK00o,项目名称:Entitas-CSharp,代码行数:7,代码来源:OrderedDictionaryGetItemByIndex.cs
示例3: HandleDups
public static void HandleDups(MethodDefinition coroutine, OrderedDictionary<Instruction, List<Instruction>> coroutineInstructions, Instruction instruction, List<Instruction> current, TypeReference expectedType, ref VariableDefinition dupLoc)
{
// FIXME: This is kindof a kludge... think on it
if (instruction.Previous.OpCode != OpCodes.Dup)
return;
var action = current.ToArray ();
current.Clear ();
if (dupLoc == null) {
dupLoc = new VariableDefinition (coroutine.Module.Import (typeof (object)));
coroutine.Body.Variables.Add (dupLoc);
}
if (expectedType.IsValueType)
current.Add (Instruction.Create (OpCodes.Box, expectedType));
current.Add (Instruction.Create (OpCodes.Stloc, dupLoc));
current.AddRange (action);
current.Add (Instruction.Create (OpCodes.Ldloc, dupLoc));
if (expectedType.IsValueType) {
current.Add (Instruction.Create (OpCodes.Unbox, expectedType));
current.Add (Instruction.Create (OpCodes.Ldobj, expectedType));
}
}
开发者ID:chkn,项目名称:cirrus,代码行数:27,代码来源:TargetIL_old.cs
示例4: LoadObjectLayers
public Layer[] LoadObjectLayers(TmxMap tmxMap, ContentManager content)
{
var layers = new Layer[tmxMap.ObjectGroups.Count];
for (int i = 0; i < tmxMap.ObjectGroups.Count; i++)
{
OrderedDictionary<string, IGameObject> _gameObjects = new OrderedDictionary<string, IGameObject>();
foreach (var tmxObject in tmxMap.ObjectGroups[i].Objects)
{
if (tmxObject.Type == "Particle Emitter")
{
IGameObject gameObject = this.LoadParticleEmitter(tmxObject, content);
_gameObjects.Add(tmxObject.Name, gameObject);
}
else if (tmxObject.Type == "NPC Spawner")
{
IGameObject gameObject = this.LoadNpcSpawner(tmxObject, _gameObjects, content);
_gameObjects.Add(tmxObject.Name, gameObject);
}
}
layers[i] = new Layer(_gameObjects, tmxMap.ObjectGroups[i].ZOrder);
}
return layers;
}
开发者ID:JohnLamontagne,项目名称:dominus-engine,代码行数:27,代码来源:MapObjectLoader.cs
示例5: Print
public static void Print(StreamWriterLevel c, OrderedDictionary<string, CLocalVariable> vars)
{
foreach (CLocalVariable v in vars.Values)
{
c.P(1);
if (v.staticDeclaration)
c.Write("static ");
c.Write("{0} {1}", v.type, v.varName);
if (v.arrayLen > 0)
c.Write("[{0}]",v.arrayLen);
if (v.initVal != "")
c.Write(" = {0}", v.initVal);
c.WriteLine(";");
//if (v.arrayLen == 0)
//{
// c.WriteLine("{0} {1} = {2};", v.type, v.varName, v.initVal);
//}
//else
//{
// c.WriteLine("{0} {1}[{2}];", v.type, v.varName, v.arrayLen);
//}
}
if (vars.Count > 0)
c.WriteLine();
}
开发者ID:kia92798,项目名称:tinyasn1,代码行数:30,代码来源:CBackend.cs
示例6: Main
static void Main(string[] args)
{
OrderedDictionary<string, SortedSet<Person>> coursesAndStudents = new OrderedDictionary<string, SortedSet<Person>>();
while (true)
{
string[] input = Console.ReadLine().Split(new[] { ' ', '|' }, StringSplitOptions.RemoveEmptyEntries);
string course = input[2].Trim();
string firstName = input[0].Trim();
string lastName = input[1].Trim();
if (coursesAndStudents.ContainsKey(course))
{
coursesAndStudents[course].Add(new Person(firstName, lastName));
}
else
{
SortedSet<Person> set = new SortedSet<Person>();
set.Add(new Person(firstName, lastName));
coursesAndStudents.Add(course, set);
}
Output(coursesAndStudents);
}
}
开发者ID:simooo93,项目名称:SoftUni-Homeworks,代码行数:25,代码来源:Program.cs
示例7: SaveInput
private static OrderedDictionary<string, SortedSet<Student>> SaveInput()
{
OrderedDictionary<string, SortedSet<Student>> input = new OrderedDictionary<string, SortedSet<Student>>();
// just link the txt file from the project ->
string path = @"C:\users\student\documents\visual studio 2012\Projects\[DSA] Data-Structures-Efficiency\1. PrintingOrderedStudents\students.txt";
StreamReader reader = new StreamReader(path);
using (reader)
{
string line = reader.ReadLine();
while (line != null && line != string.Empty)
{
string[] attribs = ParseLine(line);
Student newStud = new Student(attribs[0], attribs[1]);
if (input.ContainsKey(attribs[2]))
{
input[attribs[2]].Add(newStud);
}
else
{
input[attribs[2]] = new SortedSet<Student>();
input[attribs[2]].Add(newStud);
}
line = reader.ReadLine();
}
}
return input;
}
开发者ID:RamiAmaire,项目名称:TelerikAcademy,代码行数:30,代码来源:Demo.cs
示例8: SaveHeader
public static void SaveHeader(string szFileName, OrderedDictionary<string, int> apps, OrderedDictionary<string, int> ctrls)
{
StreamWriter stream = new StreamWriter(szFileName);
stream.WriteLine("#ifndef __RESOURCE_H");
stream.WriteLine("#define __RESORUCE_H");
stream.WriteLine("// Resource Script generated by Rose Interface Designer");
stream.WriteLine("// Developed by Pain and xLethal");
stream.WriteLine("// Copyright XorNet");
stream.WriteLine();
stream.WriteLine();
stream.WriteLine("// Applet Id");
foreach (KeyValuePair<string, int> xPair in apps)
{
stream.WriteLine("#define {0}{1}", xPair.Key.PadRight(64, ' '), xPair.Value);
}
stream.WriteLine();
stream.WriteLine("// Control Id");
foreach (KeyValuePair<string, int> xPair in ctrls)
{
stream.WriteLine("#define {0}{1}", xPair.Key.PadRight(64, ' '), xPair.Value);
}
stream.WriteLine();
stream.Write("#endif");
stream.Close();
}
开发者ID:sgrzeda,项目名称:rose,代码行数:25,代码来源:Writer.cs
示例9: HalResource
public HalResource(string rel, string href)
{
Contents = new OrderedDictionary<string, HalNode>();
Rel = rel;
Href = href;
}
开发者ID:RafaelLeonhardt,项目名称:hal,代码行数:7,代码来源:HalResource.cs
示例10: ShoppingCenter2
public ShoppingCenter2()
{
this.productsByName = new Dictionary<string, OrderedBag<Product>>();
this.productsByProducer = new Dictionary<string, OrderedBag<Product>>();
this.productsByPrice = new OrderedDictionary<decimal, OrderedBag<Product>>();
this.productsByNameAndProducer = new Dictionary<string, OrderedBag<Product>>();
}
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:7,代码来源:ShoppingCenter2.cs
示例11: BunnyWarsStructure
public BunnyWarsStructure()
{
this.rooms = new OrderedSet<int>();
this.roomsById = new OrderedDictionary<int, Dictionary<int, List<Bunny>>>();
this.bunniesByTeam = new Dictionary<int, SortedSet<Bunny>>();
this.bunniesByName = new OrderedDictionary<string, Bunny>(new SuffixBunnyComparator());
}
开发者ID:simooo93,项目名称:Exams,代码行数:7,代码来源:BunnyWarsStructure.cs
示例12: OrderedDictionary
public void OrderedDictionary()
{
OrderedDictionary<string, int> dict = new OrderedDictionary<string, int>();
DoTests(dict);
Assert.AreEqual(3, dict. Count, "Has 3 records left");
Assert.AreEqual(2, dict.IndexOf("test4"), "IndexOf works");
Assert.AreEqual(dict[1], 30, "Access by numeric index appears to work");
Assert.AreEqual(dict.Values[1], 30, "Access to values by index is good");
Assert.AreEqual(dict.Keys[1], "test3", "Access to values by index is good");
Assert.Throws<NotSupportedException>(Del(()=>{dict.Values[1]=333;}),"Can't set value when accessing it from the Values list");
dict.Insert(0, 100);
// indicies should have moved
Assert.AreEqual(4, dict.Count, "Has 3 records left");
Assert.AreEqual(3, dict.IndexOf("test4"), "IndexOf works");
Assert.AreEqual(dict[2], 30, "Access by numeric index appears to work");
Assert.AreEqual(dict[0], 100);
// check for autocreated key
Assert.AreEqual(dict.Keys[0],"0", "Autogenerated a key.");
dict.Insert(0, 100);
Assert.AreEqual(dict.Keys[0], "1", "Autogenerated another key.");
}
开发者ID:emrahoner,项目名称:CsQuery,代码行数:25,代码来源:DictionaryObjects.cs
示例13: TokenParser
public TokenParser()
{
_tokens = new OrderedDictionary<Tokens, string>();
_regExMatchCollection = new OrderedDictionary<Tokens, MatchCollection>();
_index = 0;
_inputString = string.Empty;
_customFunctionIndex = 100;
_tokens.Add(Tokens.Whitespace, "[ \\t]+");
_tokens.Add(Tokens.Newline, "[\\r\\n]+");
_tokens.Add(Tokens.Function, "func([a-zA-Z_][a-zA-Z0-9_]*)\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.LogN, "[Ll][Oo][Gg][Nn]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Sqrt, "[Ss][Qq][Rr][Tt]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Sin, "[Ss][Ii][Nn]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Cos, "[Cc][Oo][Ss]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Tan, "[Tt][Aa][Nn]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Abs, "[Aa][Bb][Ss]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Log, "[Ll][Oo][Gg]\\(((?<BR>\\()|(?<-BR>\\))|[^()]*)+\\)");
_tokens.Add(Tokens.Variable, "[a-zA-Z_][a-zA-Z0-9_]*");
_tokens.Add(Tokens.Float, "([0-9]+)?\\.+[0-9]+");
_tokens.Add(Tokens.Integer, "[0-9]+");
_tokens.Add(Tokens.Lparen, "\\(");
_tokens.Add(Tokens.Rparen, "\\)");
_tokens.Add(Tokens.Exponent, "\\^");
_tokens.Add(Tokens.Modulus, "\\%");
_tokens.Add(Tokens.Multiply, "\\*");
_tokens.Add(Tokens.Divide, "\\/");
_tokens.Add(Tokens.Add, "\\+");
_tokens.Add(Tokens.Subtract, "\\-");
}
开发者ID:FlorianRappl,项目名称:YAMP,代码行数:30,代码来源:Lexer.cs
示例14: RemoveNumbersThatOccurOddNumbers
public static string RemoveNumbersThatOccurOddNumbers(int[] input)
{
HashSet<int> whiteList = new HashSet<int>();
var uniqueValuesInList = new OrderedDictionary<int, int>();
foreach (var item in input)
{
if (uniqueValuesInList.ContainsKey(item))
{
uniqueValuesInList[item]++;
}
else
{
uniqueValuesInList.Add(item, 1);
}
}
string result = null;
foreach (var item in uniqueValuesInList)
{
if (item.Value >= (uniqueValuesInList.Count / 2) + 1)
{
result = string.Format("Majorant number is {0}.", item.Key);
}
}
if (result == null)
{
result = "Does not exist majorant number.";
}
return result;
}
开发者ID:quela,项目名称:myprojects,代码行数:32,代码来源:FindMajorant.cs
示例15: PersonCollection
public PersonCollection()
{
this.personDatabase = new Dictionary<string, Person>();
this.databaseOrderedByDomain = new Dictionary<string, SortedSet<Person>>();
this.databaseOrderedByNameAndTown = new Dictionary<string, SortedSet<Person>>();
this.databaseOrderedByAgeAndEmail = new OrderedDictionary<int, SortedSet<Person>>();
this.databaseOrderedByAgeTownAndEmail = new Dictionary<string, OrderedDictionary<int, SortedSet<Person>>>();
}
开发者ID:MishoMihaylov,项目名称:Homeworks,代码行数:8,代码来源:PersonCollection.cs
示例16: PersonCollection
public PersonCollection()
{
this.personsByEmail = new Dictionary<string, Person>();
this.personsByDomain = new Dictionary<string, SortedSet<Person>>();
this.personsByNameAndTown = new Dictionary<Tuple<string, string>, SortedSet<Person>>();
this.personsByAge = new OrderedDictionary<int, SortedSet<Person>>();
this.personsByTownAndAge = new Dictionary<string, OrderedDictionary<int, SortedSet<Person>>>();
}
开发者ID:pavelilchev,项目名称:HomeWorks,代码行数:8,代码来源:PersonCollection.cs
示例17: PersonCollection
public PersonCollection()
{
this.peopleByEmail = new Dictionary<string, Person>();
this.peopleByDomain = new Dictionary<string, SortedDictionary<string, Person>>();
this.peopleByNameAndTown = new Dictionary<string, SortedDictionary<string, Person>>();
this.peopleByAge = new OrderedDictionary<int, SortedDictionary<string, Person>>();
this.peopleByTownThenByAge = new Dictionary<string, OrderedDictionary<int, SortedDictionary<string, Person>>>();
}
开发者ID:sideroff,项目名称:Softuni,代码行数:8,代码来源:PersonCollection.cs
示例18: AppendItem
public void AppendItem()
{
OrderedDictionary<string, string> dictionary = new OrderedDictionary<string, string>();
dictionary.Add("1", "one");
dictionary.Add("2", "two");
Assert.AreEqual(2, dictionary.Count);
}
开发者ID:johndkane,项目名称:GenericOrderedDictionary,代码行数:8,代码来源:OrderedDictionaryTester.cs
示例19: Database
// id - product
// prod by price range
// prod by title
// prod by title + price
// prod by title + price range
// prod by supplier + price
// prod by supplier + price range
// remove by id - true/false
// products are always sorted by id
public Database()
{
productsById = new Dictionary<string, Product>();
productsByTitle = new Dictionary<string, OrderedBag<Product>>();
productsByPriceRange = new OrderedDictionary<double, OrderedBag<Product>>();
productsByTitleAndPriceRange = new OrderedDictionary<string, OrderedDictionary<double, OrderedBag<Product>>>();
productsBySupplierAndPriceRange = new OrderedDictionary<string, OrderedDictionary<double, OrderedBag<Product>>>();
}
开发者ID:AsenTahchiyski,项目名称:SoftUni,代码行数:17,代码来源:Database.cs
示例20: ClepsClassBuilder
public ClepsClassBuilder(string name)
{
FullyQualifiedName = name;
MemberVariables = new OrderedDictionary<string, ClepsType>();
MemberMethods = new Dictionary<string, ClepsType>();
StaticMemberVariables = new Dictionary<string, ClepsType>();
StaticMemberMethods = new Dictionary<string, ClepsType>();
}
开发者ID:shravanrn,项目名称:Cleps,代码行数:8,代码来源:ClepsClassBuilder.cs
注:本文中的OrderedDictionary类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论