问题
I'm writing an Event Booking system in C#, which is vexing me greatly because "event" and "delegate" are reserved words. "Delegate" I've changed to "Attendee", but I can't think of an alternative name for the Event class (and instances thereof). The best I've come up with is "Happening", which is a little bit 1970s for my liking. Plus, the classes will be exposed via a customer API so I have to use professional terminology.
Any suggestions would be most gratefully received.
Edit: it is mainly the naming of instances and parameters that is bothering me:
public Booking CreateBooking(Event event, Person person);
回答1:
If you really want to use a C# reserved word, you can prefix it with '@'.
E.g.
public class @class
{
...
}
Use with caution...
回答2:
I would just go with Event. Type names are case-sensitive, so there is a distinction between event and Event. It is (in my humble opinion) the least confusing and most clear solution to the problem.
回答3:
I would personally just use Event
. That doesn't come up as a type name very often. One alternative might be Meeting
but it depends on what kind of events you're talking about.
Event really is the right name in the business domain here, for calendars in general.
If you've got recurrent events though, you'll also have exceptions. They're fun - is an EventException
an exception to a recurrent event, or a failure to do something with an exception?
None of this can even touch fun with time zones though.
回答4:
But, event is a keyword, not Event (case sensitivity). Why not use Event? It seems like it is the best name for the job.
回答5:
C# is case sensitive, why not go with "Event" (capital E)?
回答6:
Event at thesaurus.reference.com
Or think about using Event
and @event
.
回答7:
You could always fall back to old-school naming by pre-pending your classes with a "C" (for Class)
CEvent,CDelegate,CMyClass
来源:https://stackoverflow.com/questions/752040/suggest-class-names-for-an-event-booking-system