What will be printed out as a result of the following code execution:
 
using System; using System.Collections.ObjectModel; 

using ByteCollection1 = System.Collections.ObjectModel.Collection<byte>; 

namespace CollectionApplication 
{ 
    class Program
    { 
          class ByteCollection2 : Collection<byte> { } 

          static void Main(string[] args) 
          { 
              Console.WriteLine(typeof(ByteCollection1) == typeof(Collection<byte>));              
              Console.WriteLine(typeof(ByteCollection2) == typeof(Collection<byte>));
        } 
     } 
}

 
Explanation
class ByteCollection2 : Collection { } - is a new type already.
Therefore, typeof(ByteCollection2) returns the result that is different from that of typeof(Collection<T>)), say T = int.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback