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

  • CNNMoney

    CNNMoney

    16 Kasım 2006
  • 趣味そうこ♪

    趣味そう

    3 Mart 2010
  • The Onion

    The Onion

    14 Mart 2006