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

  • Blu animations and other videos

    Blu animatio

    15 HAZİRAN 2007
  • Sergio Fernandez

    Sergio Ferna

    1 EKİM 2009
  • videoisunrelated

    videoisunrel

    5 Mart 2009