Below is a sample sourcecode demonstrating the usage of the var keyword within the indexes in the Foreach statement in c#.
var keyword in Foreach Statement in C#
using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace AbundantCode { internal class Program { //Foreach private static void Main(string[] args) { var AbundantCodeVersions = new string[] { "AbundantCode v1", "AbundantCode v3", "AbundantCode v3", }; foreach(var i in AbundantCodeVersions) Console.WriteLine(i); Console.ReadLine(); } } }
Leave a Reply