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

  • Google Developers

    Google Devel

    23 AĞUSTOS 2007
  • HowcastTechGadgets

    HowcastTechG

    22 EYLÜL 2010
  • segtlim

    segtlim

    21 EKİM 2008