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


Top 5 Contributors of the Month
david stephan

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

Responses
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
http://msdn.microsoft.com/en-us/library/aa711607(VS.71).aspx

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
http://forum.wedost.com
Author: Akhil Raj       [Moderator]      
Posted Date: July 22, 2009     Points: 5   

Please check the following notes also..for simple understanding

http://en.csharp-online.net/All_about_Arrays_in_CSharp%E2%80%94Array_Covariance




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
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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