Why does System.Windows.MessageBoxImage have enumeration sub-items with the same value?

Posted by devdigital on Stack Overflow See other posts from Stack Overflow or by devdigital
Published on 2010-05-17T07:37:41Z Indexed on 2010/05/17 7:40 UTC
Read the original article Hit count: 541

Hi, I'm trying to write my own abstraction over the MessageBoxImage enumeration, and see that MessageBoxImage is defined as:

namespace System.Windows
  {
      public enum MessageBoxImage
      {
          None = 0,
          Error = 16,
          Hand = 16,
          Stop = 16,
          Question = 32,
          Exclamation = 48,
          Warning = 48,
          Asterisk = 64,
          Information = 64,
      }
  }

How does the Show method determine whether to display an Error image or a Hand image? How would I write a method which takes a MessageBoxImage type, and return a CustomMessageBoxImage type which maps to the MessageBoxImage type, as I can't include both MessageBoxImage.Error and MessageBoxImage.Hand in the same switch statement?

© Stack Overflow or respective owner

Related posts about Windows

Related posts about messagebox