Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

dynamic arrays in c#

List<string> list = new List<string>();
list.Add("one");
list.Add("two");
list.Add("three");

string[] array = list.ToArray();
Comment

dynamic arrays in c#

Console.WriteLine("Define Array Size? ");
int number = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Enter numbers:
");
int[] arr = new int[number];

for (int i = 0; i < number; i++)
{
    arr[i] = Convert.ToInt32(Console.ReadLine());
}
for (int i = 0; i < arr.Length; i++ )
{
    Console.WriteLine("Array Index: "+i + " AND Array Item: " + arr[i].ToString());
}
Console.ReadKey();
Comment

PREVIOUS NEXT
Code Example
Csharp :: WPF Confirmation MessageBox 
Csharp :: unity editor dropdown 
Csharp :: c# onmousedown. unity 
Csharp :: unity c# check how many of an object exists 
Csharp :: c# csv read write 
Csharp :: move files from one folder to another using c# 
Csharp :: how to remove space between string in c# 
Csharp :: how to add to a list c# 
Csharp :: mapping dictionary to object c# 
Csharp :: what does static mean in c# 
Csharp :: get last character of string c# 
Csharp :: add all elements in a list c# 
Csharp :: unity exception 
Csharp :: c# dictionary add 
Csharp :: how to start a webpage from a button c# 
Csharp :: winforms C# code cross thread operation is not valid 
Csharp :: unity gameobject.find 
Csharp :: project mongodb c# 
Csharp :: instantiate unity 2d in parent 
Csharp :: streamwriter c# 
Csharp :: string to datetime c# 
Csharp :: c# convert datetime to unix timestamp 
Csharp :: sorting a list of objects in c# 
Csharp :: c# remove first three characters from string 
Csharp :: checking if character is a digit or not in c# 
Csharp :: c# .net core memory cache 
Csharp :: c# replace dash in string 
Csharp :: c# tell if list object is empty 
Csharp :: c# excel workbook 
Csharp :: check if an object is active unity 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =