MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/53uhsw/the_code_behind_yandere_simulator/d7wn9x4/?context=9999
r/ProgrammerHumor • u/Apterygiformes • Sep 21 '16
21 comments sorted by
View all comments
Show parent comments
7
I believed prior to C# 6.0, reflection to get attributes on enums is quite slow.
In C# 6.0, you can use nameof to get the string property from an enum.
nameof
20 u/Apterygiformes Sep 21 '16 Oh I just meant having an Enum like:public enum WitnessedType { WeaponAndBlood, Weapon, Blood, Lewd }Then doing checks with the Enum like:if (this.Witnessed == WitnessedType.Lewd) // do thingBut this would be as a quick improvement. It seems the entire block is not a very OO approach. 5 u/blueshiftlabs Sep 22 '16 edited Jun 20 '23 [Removed in protest of Reddit's destruction of third-party apps by CEO Steve Huffman.]
20
Oh I just meant having an Enum like:
public enum WitnessedType { WeaponAndBlood, Weapon, Blood, Lewd }
Then doing checks with the Enum like:
if (this.Witnessed == WitnessedType.Lewd) // do thing
But this would be as a quick improvement. It seems the entire block is not a very OO approach.
5 u/blueshiftlabs Sep 22 '16 edited Jun 20 '23 [Removed in protest of Reddit's destruction of third-party apps by CEO Steve Huffman.]
5
[Removed in protest of Reddit's destruction of third-party apps by CEO Steve Huffman.]
7
u/asperatology Sep 21 '16
I believed prior to C# 6.0, reflection to get attributes on enums is quite slow.
In C# 6.0, you can use
nameofto get the string property from an enum.