static void Main(string[] args) { //System.Collections.ObjectModel.ObservableCollection<Member> members = new System.Collections.ObjectModel.ObservableCollection<Member>(); //members.CollectionChanged += Members_CollectionChanged; //members.Add(new Member //{ // Id = 1, // Fname = "Payam", // Lname = "Boroumand" //}); //System.Collections.Stack memberStack = new System.Collections.Stack(); //memberStack.Push(new Member{ Id = 1, Fname = "Payam", Lname= "Boroumand"}); //memberStack.Push(new Member{ Id = 2, Fname = "Mehrdad", Lname= "ALiMohammadi"}); //object firstElement = memberStack.Pop(); //Console.WriteLine(((Member)firstElement).ToString()); //memberStack.Push(new Member{ Id = 1, Fname = "Milad", Lname= "Karimi"}); //firstElement = memberStack.Pop(); //Console.WriteLine(((Member)firstElement).ToString()); //System.Collections.Queue membersQueue = new System.Collections.Queue(); //membersQueue.Enqueue(new Member{ Id = 1, Fname = "Payam", Lname= "Boroumand"}); //membersQueue.Enqueue(new Member{ Id = 1, Fname = "Mehrdad", Lname= "ALi Mohammadi"}); //object firstElement = membersQueue.Dequeue(); //Console.WriteLine(((Member)firstElement).ToString()); //firstElement = membersQueue.Dequeue(); //Console.WriteLine(((Member)firstElement).ToString()); PrintMenu(); System.Collections.Generic.SortedSet <Member> sortedMembersList = new System.Collections.Generic.SortedSet <Member>(); sortedMembersList.Add(new Member { Id = 3, Fname = "Mehrdad", Lname = "ALi Mohammadi" }); sortedMembersList.Add(new Member { Id = 2, Fname = "Alireza", Lname = "Boroumand" }); sortedMembersList.Add(new Member { Id = 1, Fname = "Payam", Lname = "Boroumand" }); sortedMembersList.Add(new Member { Id = 5, Fname = "Milad", Lname = "Karimi" }); sortedMembersList.Add(new Member { Id = 4, Fname = "Amir", Lname = "Mohammadi" }); foreach (var member in sortedMembersList) { Console.WriteLine(member.ToString()); } Main(null); }
public virtual string GetNewValue(Net.Vpc.Upa.Field field) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { Net.Vpc.Upa.Entity entity = field.GetEntity(); string idName = field.GetName(); string goodId = null; for (int i = 0; i < asynchNbrTry; i++) { System.Collections.Generic.SortedSet <string> requestedIds = new System.Collections.Generic.SortedSet <string>(); Net.Vpc.Upa.Expressions.InCollection idsSet = new Net.Vpc.Upa.Expressions.InCollection(new Net.Vpc.Upa.Expressions.Var(idName)); for (int j = 0; j < synchNbrTry; j++) { string id = (string)GenerateValue(field); idsSet.Add(new Net.Vpc.Upa.Expressions.Literal(id)); requestedIds.Add(id); } System.Collections.Generic.IList <Net.Vpc.Upa.Record> recordList = entity.CreateQuery((new Net.Vpc.Upa.Expressions.Select()).From(entity.GetName()).Field(new Net.Vpc.Upa.Expressions.Var(idName)).Where(idsSet)).GetRecordList(); System.Collections.Generic.SortedSet <string> foundIds = new System.Collections.Generic.SortedSet <string>(); foreach (Net.Vpc.Upa.Record record in recordList) { foundIds.Add(record.GetString()); } Net.Vpc.Upa.Impl.FwkConvertUtils.SetRemoveRange(requestedIds, foundIds); if ((requestedIds.Count == 0)) { continue; } goodId = Net.Vpc.Upa.Impl.FwkConvertUtils.CollectionSetFirst <string>(requestedIds); break; } return(goodId); }
/** 更新。 */ public static void Main(string a_label = nameof(Test_24)) { UnityEngine.Debug.Log("----- " + a_label + " -----"); try{ System.Collections.Generic.SortedSet <int> t_item_from = new System.Collections.Generic.SortedSet <int>(); { t_item_from.Add(1); t_item_from.Add(2); t_item_from.Add(3); } //オブジェクト ==> JSONITEM。 #if (FEE_JSON) Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <System.Collections.Generic.SortedSet <int> >(t_item_from); #endif //JSONITEM ==> JSON文字列。 #if (FEE_JSON) string t_jsonstring = t_jsonitem.ConvertToJsonString(); #else string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from); #endif //JSON文字列 ==> オブジェクト。 #if (FEE_JSON) System.Collections.Generic.SortedSet <int> t_item_to = Fee.JsonItem.Convert.JsonStringToObject <System.Collections.Generic.SortedSet <int> >(t_jsonstring); #else System.Collections.Generic.SortedSet <int> t_item_to = UnityEngine.JsonUtility.FromJson <System.Collections.Generic.SortedSet <int> >(t_jsonstring); #endif //ログ。 UnityEngine.Debug.Log(a_label + " : " + t_jsonstring); //チェック。 if (Check(t_item_from, t_item_to) == false) { UnityEngine.Debug.LogError("mismatch"); } }catch (System.Exception t_exception) { UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message); } }
public virtual System.Collections.Generic.ICollection <Net.Vpc.Upa.Impl.Persistence.ValidationPass> GetValidationPasses() { System.Collections.Generic.SortedSet <Net.Vpc.Upa.Impl.Persistence.ValidationPass> ts = new System.Collections.Generic.SortedSet <Net.Vpc.Upa.Impl.Persistence.ValidationPass>(); foreach (Net.Vpc.Upa.Impl.Persistence.ValidationPass[] o in (orderedPasses).Values) { for (int i = 0; i < 4; i++) { if (o[i] != null) { ts.Add(o[i]); } } } return(ts); }
static void Main(string[] args) { var visits = new System.Collections.Generic.SortedSet <EDJournal.SystemVisit>(); var systems = new System.Collections.Generic.HashSet <string>(); string journal_path = System.IO.Path.Combine( Environment.GetEnvironmentVariable("USERPROFILE"), "Saved Games", "Frontier Developments", "Elite Dangerous" ); foreach (string journal_file in System.IO.Directory.EnumerateFiles(journal_path, "Journal.*.log")) { foreach (var visit in EDJournal.Consumer.ProcessFile(journal_file)) { visits.Add(visit); systems.Add(visit.Name); } } double distance = 0; EDJournal.Position previous = null; foreach (var visit in visits) { if (previous != null) { distance += visit.DistanceTo(previous); } previous = visit.Position; } Console.WriteLine("Found {0} visits to {1} distinct systems. Travelled {2} light years.", visits.Count, systems.Count, distance.ToString("N2", CultureInfo.CreateSpecificCulture("en-UK")) ); }
void AddLockStateTracker(LockState state) { lock (managers) { managers.Add(state); } }
// METHODS public void Add(T item) => priorityQueue.Add(item);