Skip to content

Instantly share code, notes, and snippets.

@igniuss
Created July 12, 2017 07:34
Show Gist options
  • Save igniuss/1fe307798aef1bf1a729168d39f9d1b7 to your computer and use it in GitHub Desktop.
Save igniuss/1fe307798aef1bf1a729168d39f9d1b7 to your computer and use it in GitHub Desktop.
Simple example of array accessor using enums
public class MessageType {
public string[] array;
public enum MessageEnum {
Shutdown = 0,
Reboot = 1,
Softlock = 2
}
public string this[MessageEnum val] {
get {
return array[(int)val];
}
set {
array[(int)val] = value;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment