Created
October 11, 2019 14:00
-
-
Save khyperia/5f1edf1491da34b03a468df4e08dd3cc to your computer and use it in GitHub Desktop.
creating an array that starts at 5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class C { | |
public static void Main() { | |
var arr = Array.CreateInstance(typeof(int), new[]{5}, new[]{5}); | |
Console.WriteLine(arr.Length); | |
for (var i = 5; i < 10; i++) | |
arr.SetValue(i * 2, i); | |
for (var i = 5; i < 10; i++) | |
Console.WriteLine(arr.GetValue(i)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
lol