Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
type experriment
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public interface IBase { void tst(); } public interface IOther { void tst2(); } public class MyClass : IBase { public void tst() { } } public class Program { static void print(string fmt, params object[] args) { Console.WriteLine(fmt, args); } public static void Main(string[] args) { //Your code goes here print("Hello, world!"); var ba = new byte[10]; var ba2 = new byte[]{1,2,4}; var l = new List<byte>(); var s = "test"; var i = 123; var b = (byte)123; print("ba : {0} {1} {2} {3} {4} {5}", ba is byte[], ba is ICollection<byte>, ba is IList<byte>, ba is IEnumerable<byte>, ba is int, ba is byte); print("ba2: {0} {1} {2} {3} {4} {5}", ba2 is byte[], ba2 is ICollection<byte>, ba2 is IList<byte>, ba2 is IEnumerable<byte>, ba2 is int, ba2 is byte); print("l : {0} {1} {2} {3} {4} {5}", l is byte[], l is ICollection<byte>, l is IList<byte>, l is IEnumerable<byte>, l is int, l is byte); print("s : {0} {1} {2} {3} {4} {5}", s is byte[], s is ICollection<byte>, s is IList<byte>, s is IEnumerable<byte>, s is int, s is byte); print("i : {0} {1} {2} {3} {4} {5}", i is byte[], i is ICollection<byte>, i is IList<byte>, i is IEnumerable<byte>, i is int, i is byte); print("b : {0} {1} {2} {3} {4} {5}", b is byte[], b is ICollection<byte>, b is IList<byte>, b is IEnumerable<byte>, b is int, b is byte); var x= new MyClass(); print("t={0}, if.t={1}, cl.t={2}", x.GetType().Name, typeof(MyClass).GetType().Name, typeof(IBase).GetType().Name); print("i=m: {0}, m=i: {1}", typeof(IBase).IsAssignableFrom(typeof(MyClass)), typeof(MyClass).IsAssignableFrom(typeof(IBase))); print("o=m: {0}, m=o: {1}", typeof(IOther).IsAssignableFrom(typeof(MyClass)), typeof(MyClass).IsAssignableFrom(typeof(IOther))); print("i=x: {0}, o=x: {1}", typeof(IBase).IsAssignableFrom(x.GetType()), typeof(IOther).IsAssignableFrom(x.GetType())); print("x is i: {0}, x is o: {1}", x is IBase, x is IOther); } } }
run
|
edit
|
history
|
help
0
Abstract Class
Trading
Lambdas and closures in C#
example
encryption
Fórum ➡ Border of a string S with at least 3 non-overlapping solutions ( yield version ) ♦
ICollection<T>.Add(T) - Performance Test
contraseña
extrefGenerate
Game v 1.0