add the solution to the log entry excercise
This commit is contained in:
parent
b5937adcdf
commit
da1cc7d7f4
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
|
||||
namespace se_12_log_entry
|
||||
{
|
||||
public class LogEntry
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
public LogEntry(int _id, DateTime _date)
|
||||
{
|
||||
this.ID = _id;
|
||||
this.Date = _date;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Policy;
|
||||
|
||||
namespace se_12_log_entry
|
||||
{
|
||||
|
@ -7,6 +8,20 @@ namespace se_12_log_entry
|
|||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Stack<LogEntry> logEntries = new Stack<LogEntry>();
|
||||
int id_counter = 0;
|
||||
while (id_counter < 11)
|
||||
{
|
||||
logEntries.Push(new LogEntry(id_counter, DateTime.Now));
|
||||
id_counter++;
|
||||
|
||||
LogEntry newestEntry = logEntries.Peek();
|
||||
Console.WriteLine("ID:"
|
||||
+ newestEntry.ID
|
||||
+ " Date:"
|
||||
+ newestEntry.Date);
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,14 +33,15 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="System.Core"/>
|
||||
<Reference Include="System.Xml.Linq"/>
|
||||
<Reference Include="System.Data.DataSetExtensions"/>
|
||||
<Reference Include="System.Data"/>
|
||||
<Reference Include="System.Xml"/>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="LogEntry.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -52,5 +53,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
|
||||
</Project>
|
||||
</Project>
|
Reference in New Issue