https://pastein.ru/t/HY
скопируйте уникальную ссылку для отправки
Загрузка данных
internal class lab1
{
internal void run()
{
ConsoleDisp.AllocConsole();
byte b = new byte();
int i = new int();
short sh = new short();
//string str = new string("0");
sbyte sb = new sbyte();
ushort ush = new ushort();
uint ui = new uint();
long l = new long();
ulong ul = new ulong();
char ch = new char();
float fl = new float();
double doub = new double();
decimal dec = new decimal();
int bs = Marshal.SizeOf(b), iss = Marshal.SizeOf(i), shs = Marshal.SizeOf(sh),
/*strs = Marshal.SizeOf<string>(str),*/ sbs = Marshal.SizeOf(sb), ushs = Marshal.SizeOf(ush),
uis = Marshal.SizeOf(ui), ls = Marshal.SizeOf(l), uls = Marshal.SizeOf(ul), chs = Marshal.SizeOf(ch),
fls = Marshal.SizeOf(fl), doubs = Marshal.SizeOf(doub), decs = Marshal.SizeOf(dec);
Console.WriteLine("--------Table of sizes of types in C#--------");
Console.WriteLine($"BYTE-----------------{bs}-------From ({byte.MinValue}) to ({byte.MaxValue})");
Console.WriteLine($"INT------------------{iss}-------From ({int.MinValue}) to ({int.MaxValue})");
Console.WriteLine($"SHORT----------------{shs}-------From ({short.MinValue}) to ({short.MaxValue})");
Console.WriteLine($"SBYTE----------------{sbs}-------From ({sbyte.MinValue}) to ({sbyte.MaxValue})");
Console.WriteLine($"USHORT---------------{ushs}-------From ({ushort.MinValue}) to ({ushort.MaxValue})");
Console.WriteLine($"UINT-----------------{uis}-------From ({uint.MinValue}) to ({uint.MaxValue})");
Console.WriteLine($"LONG-----------------{ls}-------From ({long.MinValue}) to ({long.MaxValue})");
Console.WriteLine($"ULONG----------------{uls}-------From ({ulong.MinValue}) to ({ulong.MaxValue})");
Console.WriteLine($"CHAR-----------------{chs}-------From ({char.MinValue}) to ({char.MaxValue})");
Console.WriteLine($"FLOAT----------------{fls}-------From ({float.MinValue}) to ({float.MaxValue})");
Console.WriteLine($"DOUBLE---------------{doubs}-------From ({double.MinValue}) to ({double.MaxValue})");
Console.WriteLine($"DECIMAL--------------{decs}------From ({decimal.MinValue}) to ({decimal.MaxValue})");
Console.WriteLine("\n\n");
float[] arr = new float[] { 3.5F, 7.3F, 5.5F, 3.2F };
Console.Write("The containment of the float[] array: ");
foreach (float a in arr)
{
Console.Write($"{a} ");
}
Console.WriteLine("\n\n");
Date date1 = new Date();
try
{
date1.M = (Months)7;
}
catch (Exception ex)
{
Console.WriteLine($"{ex.Message}");
Console.WriteLine($"{ex.Data}");
}
try
{
date1.D = 16;
}
catch (Exception ex)
{
Console.WriteLine($"{ex.Message}");
Console.WriteLine($"{ex.Data}");
}
try
{
date1.Y = 2001;
}
catch (Exception ex)
{
Console.WriteLine($"{ex.Message}");
Console.WriteLine($"{ex.Data}");
}
date1.consoleOutput();
Console.ReadKey();
ConsoleDisp.FreeConsole();
}
}
Это другой класс в файле
public static class Controller
{
static lab1 l1 = new lab1();
static lab2 l2 = new lab2();
static lab3 l3 = new lab3();
static lab5 l5 = new lab5();
static lab6 l6 = new lab6();
static lab7 l7 = new lab7();
static lab8 l8 = new lab8();
static lab9 l9 = new lab9();
static lab10 l10 = new lab10();
static lab11 l11 = new lab11();
static lab12 l12 = new lab12();
static lab13 l13 = new lab13();
static lab14 l14 = new lab14();
static lab15 l15 = new lab15();
static lab16 l16 = new lab16();
public static void run_1()
{
l1.run();
}
}
А это отдельный файл
class ConsoleDisp
{
[DllImport("Kernel32.dll")]
public static extern Boolean AllocConsole();
[DllImport("Kernel32.dll")]
public static extern Boolean FreeConsole();
}