[Mono-devel-list] Re: Fixes to XSLT

Stephen Quattlebaum Stephen.Quattlebaum at dynetics.com
Tue Feb 8 09:56:05 EST 2005


> > Hm, MonoDevelop then has to solve this problem somehow. What will
happen 
> > if a user defines her own enum where few members have an equal
value? 
> > Then you must go further and forbid such enum members in the
language 
> > like you forbid duplicated cases in switch statement.
>
> Is there such an enumeration type which is not buggy?
>

What about cases like this?

public enum MyTextDirection {

	[ Obsolete ]
	Left = 0,

	[ Obsolete ]
	Right = 1,

	LeftToRight = 0,	// Preferred over Left

	RightToLeft = 1	// Preferred over Right
}

Or this (this may not be the best example but it gets the point across).

public enum MyCollation {

	USEnglish = 0,

	UKEnglish = 0,

	Croatian = 1,

	// etc...
}

The actual value of an enumerated type is, in many cases, an
implementation detail.  There may be perfectly valid reasons for wanting
aliases that map to the same action when the enumeration is used.  That
leads to difficulties when deserializing and casting between the enum
and the underlying type, but not every enumeration is intended to be
suitable for such tasks.

My memory may be failing me, but I _think_ I remember seeing some cases
where aliases like this exist in the framework.  Could be wrong.



More information about the Mono-devel-list mailing list