You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.3 KiB
98 lines
2.3 KiB
|
1 year ago
|
using Pi232._0920;
|
||
|
|
|
||
|
|
namespace ConsoleApp1;
|
||
|
|
|
||
|
|
class Program
|
||
|
|
{
|
||
|
|
static void Main(string[] args)
|
||
|
|
{
|
||
|
|
// h_TestSep12();
|
||
|
|
List<Bus> arBus = h_GetBusList();
|
||
|
|
foreach (Bus bus in arBus)
|
||
|
|
{
|
||
|
|
Console.WriteLine(bus);
|
||
|
|
}
|
||
|
|
|
||
|
|
// enType = (ETransport)1;
|
||
|
|
}
|
||
|
|
|
||
|
|
private static List<Bus> h_GetBusList()
|
||
|
|
{
|
||
|
|
Driver driver1 = new Driver("Surname Firstname Middlename");
|
||
|
|
Bus bus1 = new Bus("40", driver1);
|
||
|
|
Bus bus2 = new Bus("91", driver1);
|
||
|
|
List<Bus> arBus = new List<Bus>(8);
|
||
|
|
arBus.Add(bus1);
|
||
|
|
arBus.Add(bus2);
|
||
|
|
return arBus;
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void h_TestSep12()
|
||
|
|
{
|
||
|
|
const int MaxNumber = 12;
|
||
|
|
Byte bb = new byte();
|
||
|
|
new byte();
|
||
|
|
bb = MaxNumber;
|
||
|
|
string ss = new string('1', 10);
|
||
|
|
ss = "1";
|
||
|
|
int ii = default(int);
|
||
|
|
int kk;
|
||
|
|
|
||
|
|
DateTime dt = DateTime.Now;
|
||
|
|
DateTime dt2 = new DateTime(2024, 09, 10);
|
||
|
|
|
||
|
|
DateTimeOffset dto = DateTimeOffset.Now;
|
||
|
|
|
||
|
|
Console.WriteLine($"Hello, World: {dt.ToString("yy-MM-dd")}!");
|
||
|
|
Console.WriteLine($"Hello, World: {dt:yy-MM-dd}!");
|
||
|
|
Console.WriteLine($"{(dt - dt2).TotalSeconds} / {(dt - dt2).Seconds}!");
|
||
|
|
|
||
|
|
dt.AddMinutes(1000).AddSeconds(-100);
|
||
|
|
|
||
|
|
|
||
|
|
h_Loops();
|
||
|
|
}
|
||
|
|
|
||
|
|
private static void h_Loops()
|
||
|
|
{
|
||
|
|
while ((
|
||
|
|
DateTime.Now.Second != 0
|
||
|
|
&& // and
|
||
|
|
DateTime.Now.Millisecond == 0)
|
||
|
|
|| // or
|
||
|
|
(DateTime.Now.Millisecond == 1))
|
||
|
|
{
|
||
|
|
bool bTrue = true;
|
||
|
|
bTrue = !bTrue;
|
||
|
|
//...
|
||
|
|
|
||
|
|
short ss1; // Int16
|
||
|
|
ushort us1; // UInt16
|
||
|
|
int ii; // Int32
|
||
|
|
long ll; // Int64
|
||
|
|
}
|
||
|
|
|
||
|
|
do
|
||
|
|
{
|
||
|
|
break; //
|
||
|
|
} while (true);
|
||
|
|
|
||
|
|
// 1. initializer = expression
|
||
|
|
// 2. precondition = boolean
|
||
|
|
// 3. postaction = expression
|
||
|
|
for ( /* 1 */ int ii = 0; /*2*/ii < 10; /*3*/ ii++)
|
||
|
|
{
|
||
|
|
Console.WriteLine(ii);
|
||
|
|
}
|
||
|
|
|
||
|
|
var jj = 0;
|
||
|
|
for ( /* 1 */; /*2*/; /*3*/)
|
||
|
|
{
|
||
|
|
if (jj < 10) break;
|
||
|
|
Console.WriteLine(jj);
|
||
|
|
jj++;
|
||
|
|
}
|
||
|
|
|
||
|
|
int[] ar = { 1, 2, 3, 4 };
|
||
|
|
}
|
||
|
|
}
|