14
වර්ගය පරීක්ෂා කිරීම: typeof, GetType, හෝ?
බොහෝ අය පහත කේතය භාවිතා කරන බව මම දැක ඇත්තෙමි: Type t = typeof(obj1); if (t == typeof(int)) // Some code here නමුත් මම දන්නවා ඔබටත් මෙය කළ හැකි බව: if (obj1.GetType() == typeof(int)) // Some code here හෝ මෙය: if (obj1 is int) // Some code here පුද්ගලිකව, මට …