array of string with unknown size

0 votes
How to add array of string where the array size is unknown in C#.NET?
Jun 6 in C# by rajiv
• 1,620 points
49 views

1 answer to this question.

0 votes

Is there a specific reason why an array is required? If you don't know the size ahead of time, you can use List<String>

List<String> list = new List<String>();

list.Add("Hello");
list.Add("world");
list.Add("!");

Console.WriteLine(list[2]);

This will give you this output

!
answered Jun 7 by pranav
• 2,580 points

Related Questions In C#

0 votes
1 answer

How to initialize a list of strings (List<string>) with many string values

Simply remove the () at the end. List<string> ...READ MORE

answered Jun 13 in C# by krishna
• 2,640 points
22 views
0 votes
0 answers

How can I split a string with a string delimiter

Suppose this is my string My name is ...READ MORE

Jun 11 in C# by krishna
• 2,640 points
15 views
0 votes
0 answers

How to add a gridview to a C# winforms project with a list of objects as the datasource

In Visual Studio 2015 community, I'm creating ...READ MORE

Jun 11 in C# by krishna
• 2,640 points
13 views
0 votes
1 answer

What are the differences between C, C# and C++ in terms of real-world applications?

C is a bare-bones, straightforward, and clean ...READ MORE

answered May 30 in C# by rajiv
• 1,620 points
30 views
0 votes
3 answers

Trying to upload files using Selenium(C#)

You can try using Javascript Executor to ...READ MORE

answered Aug 23, 2019 in Selenium by Abha
• 28,120 points
4,515 views
0 votes
2 answers

How an object array can be converted to string array in java?

System.arraycopy is the most efficient way, but ...READ MORE

answered Aug 8, 2018 in Java by Sushmita
• 6,900 points
2,990 views
0 votes
2 answers

How does random shuffling of an array

Here is a simple way using an ArrayList: List<Integer> ...READ MORE

answered Nov 2, 2018 in Java by Sushmita
• 6,900 points
253 views
0 votes
1 answer

Deploy my Windows 10 IOT core application locally!

Of course, you, can! That is, in ...READ MORE

answered Jul 17, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
517 views
0 votes
1 answer

Which version of C# am I using

From developer cmd, type this csc -langversion:? This will ...READ MORE

answered Jun 7 in C# by pranav
• 2,580 points
21 views
0 votes
1 answer

Examples of dynamic polymorphism in c#

Check the example of polymorphism below. We ...READ MORE

answered Jun 7 in C# by pranav
• 2,580 points
33 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP