public static void Execute() { // example comes from http://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx var generator = new NumberGenerator(); var d = new SimpleThing(generator.ReturnFive); d += generator.ReturnTen; d += generator.ReturnFiftyFour; d += generator.ReturnThirty; var exceptions = new List<Exception>(); foreach (SimpleThing thing in d.GetInvocationList()) { try { thing(); } catch (Exception e) { Console.WriteLine(" Invocation of {0} failed", thing.Method.Name); exceptions.Add(e); } } if (!exceptions.Any()) { return; } Console.WriteLine(); throw new MulticastInvocationException(exceptions); }
public WinformWrapper() { _mapControl = new SimpleThing(); Child = _mapControl; Width = _mapControl.Width; Height = _mapControl.Height; }
public static void Execute() { // example comes from http://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx var generator = new NumberGenerator(); var d = new SimpleThing(generator.ReturnFive); d += generator.ReturnTen; d += generator.ReturnThirty; foreach (SimpleThing thing in d.GetInvocationList()) { Console.WriteLine(thing()); } }
public static void Execute() { // example comes from http://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx var generator = new NumberGenerator(); var d = new SimpleThing(generator.ReturnFive); d += generator.ReturnTen; d += generator.ReturnFiftyFour; d += generator.ReturnThirty; try { Console.WriteLine(d()); } catch (Exception exception) { Console.WriteLine(exception); } }
public FullRucksack Get(int id) { Debug.WriteLine("Start get" + id); Rucksack Rucksack; List <Thing> Things; List <SimpleThing> myThings = new List <SimpleThing>(); using (ApplicationContext db = new ApplicationContext()) { Rucksack = db.Rucksacks.Find(id); Things = db.Things.Where(p => p.Rucksack.Id == id).ToList(); } foreach (Thing thing in Things) { SimpleThing newThing = new SimpleThing { Id = thing.Id, Name = thing.Name, Weight = thing.Weight, Cost = thing.Cost, Put = thing.Put }; myThings.Add(newThing); } FullRucksack newRucksack = new FullRucksack { Things = myThings, Id = Rucksack.Id, Cost = Rucksack.Cost, Name = Rucksack.Name, Weight = Rucksack.Weight, Status = Rucksack.Status, TimeWork = Rucksack.TimeWork.TotalSeconds.ToString() }; return(newRucksack); }
public void SimpleThingIsValidAfterConstruction(bool flag) { var thing = new SimpleThing(flag); Assert.True(thing.ValidateInternalState()); }