C#: la parola chiave “is”
La keyword is consente di sapere, a runtime, se un oggetto è compatibile con un tipo specificato.
Essa restituisce
using System; namespace test { public class IsTest { public static void Main(String[] args) { String str = "ciao"; Object obj1 = str; Int32 i = 10; Object obj2 = i; Console.WriteLine(obj1 is String); Console.WriteLine(obj2 is String); Console.WriteLine(obj2 is IComparable); } } }