|
|
|
@ -9,6 +9,13 @@ namespace ConsoleApp1 |
|
|
|
{ |
|
|
|
static void Main(string[] args) |
|
|
|
{ |
|
|
|
h_DisposableDemo(); |
|
|
|
using (var object_ = h_DisposablelessDemo()) |
|
|
|
{ |
|
|
|
//...
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// h_PlayCards();
|
|
|
|
//Animal animal = new Animal();
|
|
|
|
//Animal.MilkConsumerAreaInfo info = animal.GetAreaInfo();
|
|
|
|
@ -25,6 +32,46 @@ namespace ConsoleApp1 |
|
|
|
Console.ReadKey(); |
|
|
|
} |
|
|
|
|
|
|
|
private static void h_DisposableDemo() |
|
|
|
{ |
|
|
|
using (MealConsumer human = new MealConsumer(GetMealContainer1())) |
|
|
|
{ |
|
|
|
//try
|
|
|
|
//{
|
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
Console.WriteLine(); |
|
|
|
} |
|
|
|
|
|
|
|
//}
|
|
|
|
//finally
|
|
|
|
//{
|
|
|
|
// human.Dispose();
|
|
|
|
//}
|
|
|
|
} |
|
|
|
|
|
|
|
private static MealConsumer h_DisposablelessDemo() |
|
|
|
{ |
|
|
|
MealConsumer human = new MealConsumer(GetMealContainer1()); |
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
human.ThreeHoursLater(); |
|
|
|
Thread.Sleep(3 * 60 * 60 * 1000 / 400000); |
|
|
|
Console.WriteLine(); |
|
|
|
return human; |
|
|
|
} |
|
|
|
|
|
|
|
private static IMealContainer GetMealContainer1() |
|
|
|
{ |
|
|
|
return new MealContainer(); |
|
|
|
} |
|
|
|
|
|
|
|
private static void h_WriteXml(string sXmlFn) |
|
|
|
{ |
|
|
|
if (File.Exists(sXmlFn)) File.Delete(sXmlFn); |
|
|
|
|