string[] myStrArray = new string[3];
Will create a new string array with 3 elements.
How to declare array and string in c#?
Declaring an Array:
int[] myIntArray = new int[5] { 1, 2, 3, 4, 5 };
//the above declares an array of 5 integers
Declaring a string
string MyString = "Here goes my string.";
Reply:Declare a C# array with the following syntax:
type[] array-name;
For example:
int[] myIntArray
Declare a C# String with the following syntax:
type[] String-name;
string myString;
You can even use in this way
string myString = "Hi there";
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment