private void InsertCollectionTypes() { ReportStart(_cache.CollectionType, "Collection Type"); var currentProgress = 0; foreach (var item in _cache.CollectionType) { var collectionType = item; var entity = new Entity.tCollectionType() { Type = collectionType.Value, IsPartOfOwnedCollection = collectionType.IsPartOfOwnedCollection, }; _context.tCollectionType.Add(entity); CollectionType.Add(item, entity); IncreaseCurrent(ref currentProgress); } ReportFinish(); }
private void FillCollectionTypeHash(Profiler.CollectionType collectionType) { if (collectionType == null) { throw new ArgumentNullException(nameof(collectionType)); } CollectionType.Add(collectionType); }
static void Main(string[] args) { Set set = new Set(); Set set2 = new Set(); set.Add(1); set.Add(2); set.Add(1); set.Add(5); set.Remove(1); set.Remove(-500); set.Add(-852); set2.Add(5); set2.Add(1); if (set > set2) { Console.WriteLine("set Contains set2[0]"); } set.Add(1); if (set < set2) { Console.WriteLine("set contains set2"); } set2.Add(55555); if (set < set2) { Console.WriteLine("set contains set2"); } Console.WriteLine("FIRST: " + set.First()); Set.RemovePositive(ref set); MathObject.Truncate(ref set); Console.WriteLine("MIN: " + MathObject.Min(set2)); Console.WriteLine("MAX: " + MathObject.Max(set2)); Console.WriteLine("Date is " + DateTime.Now); //=======================LAB8============================ try { CollectionType <Owner> cl = new CollectionType <Owner>(); cl.Add(new Owner(1, "1name", "1oorg")); Owner own = new Owner(2, "2name", "2oorg"); cl.Add(own); Console.WriteLine(cl.Show()); cl.Delete(own); Console.WriteLine(cl.Show()); CollectionType <string> s = new CollectionType <string>(); s.Add("222"); Console.WriteLine(s.Show()); } catch (Exception ex) { Console.WriteLine("Exception " + ex); } }
static void Main(string[] args) { CollectionType<Tor> collectionType_1 = new CollectionType<Tor>(); Tor tor1 = new Tor("ator",10, 80); Tor tor2 = new Tor("btor",20, 90); Tor tor3 = new Tor("btor",30, 70); collectionType_1.Add(tor1); collectionType_1.Add(tor2); collectionType_1.Add(tor3); foreach (Tor value in collectionType_1) value.printInfo(); WriteToFile(collectionType_1); collectionType_1.SortT(); foreach (Tor value in collectionType_1) value.printInfo(); CollectionType<Tor> collectionType_2 = new CollectionType<Tor>(); Tor tor4 = new Tor("dtor",50, 80); Tor tor5 = new Tor("etor",20, 100); Tor tor6 = new Tor("ftor",30, 70); var linkedList = new LinkedList<CollectionType<Tor>>(); linkedList.AddLast(collectionType_1); linkedList.AddFirst(collectionType_2); Console.WriteLine("where + OrderBy"); var selectedTeams = collectionType_1.Where(t => t.Name.ToUpper().StartsWith("B")).OrderBy(t => t); foreach (Tor s in selectedTeams) s.printInfo(); Console.WriteLine("Where( || + && + > )"); var selectedTeams_2 = collectionType_1.Where(t => (t.innerRadius < 100 || t.outerRadius > 70) && t.innerRadius > 20); foreach (Tor s in selectedTeams_2) s.printInfo(); Console.WriteLine("Where+Count"); var selectedTeams_3 = (collectionType_1.Where(s => s.innerRadius < 90)).Count(); Console.WriteLine(selectedTeams_3); Console.WriteLine("Select"); var selectedTeams_4 = collectionType_1.Select((h, i) => new { Index = i + 1, h.Name }); foreach (var el in selectedTeams_4) Console.WriteLine(el); Console.WriteLine("Min"); var minRes = collectionType_1.Min(h => h.outerRadius); Console.WriteLine(minRes); Console.WriteLine("Max"); var maxRes = collectionType_1.Max(h => h.outerRadius); Console.WriteLine(maxRes); Console.WriteLine("Join"); var joinRes = collectionType_1.Join(collectionType_2, o => o.innerRadius, i => i.innerRadius, (o, i) => new Tor { Name = string.Format("{0}&{1}",o.Name,i.Name), innerRadius = o.innerRadius + i.innerRadius, outerRadius = o.outerRadius + i.outerRadius }); foreach (var tor in joinRes) Console.WriteLine(tor); LinkedList<string> stringList = new LinkedList<string>(); stringList.AddFirst("ЯАнтон"); stringList.AddFirst("Саня"); stringList.AddLast("Александр"); WriteToFile(stringList); foreach (var value in stringList) Console.WriteLine("Значение: "+value); includeWord(stringList, "Саня"); Console.WriteLine(lenghtString(stringList, 4)); //var asc = stringList.OrderBy(v => v).ToList(); var asc = stringList.OrderBy(v=>v); foreach (var value in asc) Console.WriteLine("Значение: " + value); Console.WriteLine("\n"); var desc = stringList.OrderByDescending(v=>v); foreach (var value in desc) Console.WriteLine("Значение: " + value); Console.ReadKey(); }
private ITreeNodeViewModel AddNode(ITreeNodeViewModel treeNode, CollectionType parent) { parent?.Add(treeNode); return(treeNode); }