Test program (.NET 2.0):
[Flags]
enum MyEnum
{
Member1 = 1,
Member2 = 2,
}
class Program
{
// Inspecting r shows "Member1 | Member2"
MyEnum r = MyEnum.Member1 | MyEnum.Member2;
// s = "Member1, Member2"
string s = r.ToString();
}
I would have expected .ToString()
to return a string with the members separated by a pipe, but that's not the case.
Bonus info: calling Enum.Parse()
on the comma-separated string succeeds, while supplying it with a pipe-separated string fails.