Below is a sample sourcecode demonstrating the usage of the var keyword within the indexes in the for statement in c#.
var keyword in For Statements in C#
using System; using System.Collections.Generic; using System.Data; using System.Linq; namespace AbundantCode { internal class Program { //Initialize Array with Array Initializer and Anonymous Type private static void Main(string[] args) { var AbundantCodeVersions = new string[] { "AbundantCode v1", "AbundantCode v3", "AbundantCode v3", }; for (var i = 0; i < AbundantCodeVersions.Length; i++) Console.WriteLine(AbundantCodeVersions[i]); Console.ReadLine(); } } }
Leave a Reply