Reflection - Difference between DateTime.MaxValue andDecimal.MaxValue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joey Fontaine

    Reflection - Difference between DateTime.MaxValue andDecimal.MaxValue

    I just noticed that, when using intellisense, the DateTime.MaxVal ue
    field has a static property icon whereas the Decimal.MaxValu e field
    has a constant property icon. However, when looking at the
    PropertyInfo data displayed by using reflection against the types, I
    can see no inherent differences between the properties.

    How does microsoft determind this difference? Or, how can I determine
    the difference using reflection?
  • Jeroen Mostert

    #2
    Re: Reflection - Difference between DateTime.MaxVal ue and Decimal.MaxValu e

    Joey Fontaine wrote:
    I just noticed that, when using intellisense, the DateTime.MaxVal ue
    field has a static property icon whereas the Decimal.MaxValu e field
    has a constant property icon. However, when looking at the
    PropertyInfo data displayed by using reflection against the types, I
    can see no inherent differences between the properties.
    >
    Neither DateTime.MaxVal ue nor Decimal.MaxValu e are properties, they're
    fields (so I assume you're talking about FieldInfo). Both are public static
    initonly fields.
    How does microsoft determind this difference? Or, how can I determine
    the difference using reflection?
    This is a guess, but VS might be using the DecimalConstant Attribute
    associated with the decimal field (but not the DateTime field). You can
    verify this yourself by declaring

    const decimal i = 0.0;
    static readonly decimal i = 0.0;

    These produce the same declarations except for the first one having an extra
    attribute, and VS shows different icons.

    --
    J.

    Comment

    Working...