[myoe] Why there's no priority of mail?
Status: Beta
Brought to you by:
tene_
From: Weber W. <web...@ho...> - 2004-01-22 09:21:15
|
I found the mail priority is not contained in MyOE, it's a necessory property of a mail I think, add it just by a enum field in MessageItem, can use a enum by simple, and can use a typesafed enum for more flexible, the typesafed enum I write here: public sealed class MailPriority { private MailPriority(string title, int value) { this.title = title; this.value = value; } public string Title { get { return title; } } public int Value { get { return value; } } public static MailPriority[] GetValues() { MailPriority[] ps = new MailPriority[] { Highest, High, Normal, Low, Lowest, }; return ps; } public override string ToString() { return title; } private readonly string title; private readonly int value; public static readonly MailPriority Highest = new MailPriority("Highest", 1); public static readonly MailPriority High = new MailPriority("High", 2); public static readonly MailPriority Normal = new MailPriority("Normal", 3); public static readonly MailPriority Low = new MailPriority("Low", 4); public static readonly MailPriority Lowest = new MailPriority("Lowest", 5); } This is a sealed class and the instance of this class is readonly object, so needn't thinking of multithread problem and needn't clone object, it's more safe, and easy to use. Best wishes. _________________________________________________________________ 与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn |