Hey everyone,
I've got a .NET application running on WCF. In that application, I have a variety of "Types" defined ("CourseType", "PresentationType", "HierarchyType", etc) as enums. These are automatically synced with the database, so I can write nice code like:
public enum CourseType {
Online = 1,
Classroom = 2
}
...
if(course.Type == CourseType.Online) {
// do stuff on the server
}
I was wondering if anyone knew of a nice way to serialize the entire enum so I can write similar statements in JavaScript.
Note that I'm not asking about serializing just the value. What I want is to end up with some sort of JavaScript object that looks like:
CourseType = {
'online' : 1,
'classroom': 2
};
I could do this via reflection, I know, but I was hoping there was a built-in solution of some sort...