.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Array Covariance

Posted By: PankajGupta     Posted Date: July 21, 2009    Points:2   Category :C#
Please tell me about Array Covariance .
thank You

Author: Faizal             
Posted Date: July 21, 2009     Points: 5   

HI Pankaj,

Array Covariance:

For any two reference types A and B, if A is a derived type of B, a conversion exists from an array of type A to a compatible array of type B. A compatible array is an array of the same rank and type. This relationship is known as array covariance. Array covariance in particular means that an element of an array whose element type is B may actually be an element of an array whose element type is A, provided that both A and B are reference types and that B is a base type of A. In the following example, the second invocation of F causes a System.ArrayTypeMismatchException exception to be thrown because the actual element type of b is String, not Object:

For Eg please Refer

Author: PankajGupta             
Posted Date: July 22, 2009     Points: 5   

Your Answer is Good but little Confusing .Please Teach me in some more details .

Indian Search Engine Optimization Forum
Author: Akhil Raj       [Moderator]      
Posted Date: July 22, 2009     Points: 5   

Please check the following notes also..for simple understanding


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend