Skip to content

Instantly share code, notes, and snippets.

@khyperia
Created October 11, 2019 14:00
Show Gist options
  • Save khyperia/5f1edf1491da34b03a468df4e08dd3cc to your computer and use it in GitHub Desktop.
Save khyperia/5f1edf1491da34b03a468df4e08dd3cc to your computer and use it in GitHub Desktop.
creating an array that starts at 5
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));
}
}
@brucelane
Copy link

lol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment