The Labs \ Source Viewer \ SSCLI \ System.Globalization \ NumberStyles

  1. // ==++==
  2. //
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. //
  14. // ==--==
  15. /*============================================================
  16. **
  17. ** Enum:  NumberStyles.cs
  18. **
  19. **
  20. ** Purpose: Contains valid formats for Numbers recognized by
  21. ** the Number class' parsing code.
  22. **
  23. **
  24. ===========================================================*/
  25. namespace System.Globalization
  26. {
  27.    
  28.     using System;
  29.     [Flags(), Serializable()]
  30.     [System.Runtime.InteropServices.ComVisible(true)]
  31.     public enum NumberStyles
  32.     {
  33.         // Bit flag indicating that leading whitespace is allowed. Character values
  34.         // 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, and 0x0020 are considered to be
  35.         // whitespace.
  36.        
  37.         None = 0,
  38.        
  39.         AllowLeadingWhite = 1,
  40.        
  41.         AllowTrailingWhite = 2,
  42.         //Bitflag indicating trailing whitespace is allowed.
  43.         AllowLeadingSign = 4,
  44.         //Can the number start with a sign char.
  45.         //Specified by NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign
  46.         AllowTrailingSign = 8,
  47.         //Allow the number to end with a sign char
  48.         AllowParentheses = 16,
  49.         //Allow the number to be enclosed in parens
  50.         AllowDecimalPoint = 32,
  51.         //Allow a decimal point
  52.         AllowThousands = 64,
  53.         //Allow thousands separators (more properly, allow group separators)
  54.         AllowExponent = 128,
  55.         //Allow an exponent
  56.         AllowCurrencySymbol = 256,
  57.         //Allow a currency symbol.
  58.         AllowHexSpecifier = 512,
  59.         //Allow specifiying hexadecimal.
  60.         //Common uses. These represent some of the most common combinations of these flags.
  61.        
  62.         Integer = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign,
  63.        
  64.         HexNumber = AllowLeadingWhite | AllowTrailingWhite | AllowHexSpecifier,
  65.        
  66.         Number = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign | AllowDecimalPoint | AllowThousands,
  67.        
  68.         Float = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowDecimalPoint | AllowExponent,
  69.        
  70.         Currency = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign | AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol,
  71.        
  72.         Any = AllowLeadingWhite | AllowTrailingWhite | AllowLeadingSign | AllowTrailingSign | AllowParentheses | AllowDecimalPoint | AllowThousands | AllowCurrencySymbol | AllowExponent
  73.        
  74.     }
  75. }

Developer Fusion