Loops Lists and Arrays in c#
This commit is contained in:
parent
2c097039f6
commit
06a6529881
12 changed files with 243 additions and 0 deletions
11
Emne 3/Array-List/Array-List/Array-List.csproj
Normal file
11
Emne 3/Array-List/Array-List/Array-List.csproj
Normal file
|
@ -0,0 +1,11 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<RootNamespace>Array_List</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
28
Emne 3/Array-List/Array-List/Program.cs
Normal file
28
Emne 3/Array-List/Array-List/Program.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
|
||||
int[] numbers = new int[4];
|
||||
|
||||
numbers[0] = 1;
|
||||
numbers[1] = 2;
|
||||
numbers[2] = 3;
|
||||
numbers[3] = 4;
|
||||
|
||||
string[] _fourletterwords =
|
||||
{
|
||||
"WORD", "DATA", "CODE", "TEXT", "VIEW", "TASK", "FILE"
|
||||
};
|
||||
|
||||
|
||||
List<int> numbers2 = new List<int>();
|
||||
numbers2.Add(1);
|
||||
numbers2.Add(2);
|
||||
numbers2.Add(3);
|
||||
numbers2.Add(4);
|
||||
void Run()
|
||||
{
|
||||
Console.WriteLine(string.Join(' ',numbers));
|
||||
Console.WriteLine(string.Join('\t',_fourletterwords));
|
||||
Console.WriteLine(string.Join(',', numbers2));
|
||||
}
|
||||
|
||||
Run();
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue