About 19,300 results
Open links in new tab
  1. C# | Arrays of Strings - GeeksforGeeks

    Nov 19, 2019 · C# string array is basically an array of objects. It doesn’t matter whether you are creating an array of string using string keyword or String class object . Both are same.

  2. c# - Options for initializing a string array - Stack Overflow

    Sep 3, 2013 · string[] myString = new string[]{"string1", "string2"}; or. string[] myString = new string[4]; myString[0] = "string1"; // etc. Advanced: From a List. list<string> = new list<string>(); //... read this in from somewhere string[] myString = list.ToArray(); From StringCollection

  3. C# Arrays - W3Schools

    We have now declared a variable that holds an array of strings. To insert values to it, we can use an array literal - place the values in a comma-separated list, inside curly braces: To create an array of integers, you could write: You access an array element by referring to the index number.

  4. How to Initialize, assign and return a string array in c#

    Oct 5, 2017 · string[] sArray = new string[] {"hi", "hello", "foo"}; Or you can also do this: string str1 = "hi"; string str2 = "this"; string str3 = "is"; string str4 = "sample array"; string[] sArray = {str1, str2, str3, str4};

  5. How do I declare an array of strings with an unknown size?

    List<string> myStringList = new List<string(); myStringList.Add("Test 1"); myStringList.Add("Test 2"); Or, if you need to be absolutely sure that the strings remain in order: Queue<string> myStringInOriginalOrder = new Queue<string(); myStringInOriginalOrder.Enqueue("Testing..."); myStringInOriginalOrder.Enqueue("1..."); myStringInOriginalOrder ...

  6. Implementing C# String Array - C# Corner

    In this article, you will learn how to implement an array of strings in C#. There are there common ways to implement string arrays in C#: ArrayList class. 1. Array of strings. The simplest form of an array of strings is using string syntaxes on a string type. …

  7. How to Create a String Array in C# - Web Dev Tutor

    Jul 22, 2024 · To create a string array in C#, you can use the following syntax: string[] stringArray = new string[] { "Apple", "Banana", "Orange", "Grapes" }; In this example, we have created a string array named stringArray that contains four strings: "Apple", "Banana", "Orange", and "Grapes".

  8. How to Create an Array of Strings in C# - webdevtutor.net

    Jul 22, 2024 · To create an array of strings in C#, you can use the following syntax: string[] stringArray = new string[] { "Apple", "Banana", "Orange", "Grapes" }; In this example, we have initialized an array stringArray containing four strings: "Apple", "Banana", "Orange", and "Grapes".

  9. Creating string array in C# - A-Z Tech

    Oct 18, 2018 · As array in C# is a reference type, the new keyword is used to create a string array. Learn how to create/use string arrays in C#.

  10. String Array in C# | Learn Initialization of String Array and …

    Mar 17, 2023 · Guide to the String Array in C#. Here we discuss the basic concept, Declaration Syntax, Initialization of String Array along with examples.

  11. Some results have been removed
Refresh