xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to create a list in C#
C# Online Editor
Execute Code
More C# Sample Code
using System; using System.Collections.Generic; //add this namespace for list namespace ExampleApp { class Program { static void Main(string[] args) { // Create a list of strings List<string> fruits = new List<string>(); // Add elements to the fruit list fruits.Add("Apple"); fruits.Add("Banana"); fruits.Add("Mango"); fruits.Add("Orange"); // Access elements of the list using foreach loop foreach (string item in fruits) { Console.WriteLine(item); } //Access elements of the list using index number Console.WriteLine(fruits[2]); } } }