Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JuanjoSalvador/a4f1c4cbd5ecd52d0f0f7f4f65b5d337 to your computer and use it in GitHub Desktop.
Save JuanjoSalvador/a4f1c4cbd5ecd52d0f0f7f4f65b5d337 to your computer and use it in GitHub Desktop.
Comparison between C# and Python while working with enumerators

C#

Dictionary<string, string> animations = new Dictionary<string, string>
{
	{ Animation.HIGH_PUNCH.ToString(), "Punching L" },
	{ Animation.LOW_PUNCH.ToString(), "Punching R" },
	{ Animation.IDLE.ToString(), "Fighting Idle" }
};

void GetAnimation(string animationKey)
{
	return animations[animationKey];
}

Python

class Animation(Enum):
    HIGH_PUNCH = "Punching L"
    LOW_PUNCH = "Punching R"
    IDLE = "Fighting Idle"

def getAnimation(animationKey):
    return Animation[animationKey].value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment