SORU
27 NİSAN 2010, Salı


Eğer Türü örnek C null bir numaralama olup olmadığını kontrol etme#

Nasıl bir Tip C null bir numaralama ise kontrol edebilirim# gibi bir şey

Type t = GetMyType();
bool isEnum = t.IsEnum; //Type member
bool isNullableEnum = t.IsNullableEnum(); How to implement this extension method?

CEVAP
27 NİSAN 2010, Salı


public static bool IsNullableEnum(this Type t)
{
    Type u = Nullable.GetUnderlyingType(t);
    return (u != null) && u.IsEnum;
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Blue Lightning TV

    Blue Lightni

    9 EKİM 2011
  • Samantha Crain

    Samantha Cra

    30 EKİM 2008
  • tatermoog

    tatermoog

    2 AĞUSTOS 2006