March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
namespace Samples
{
public class ArrayTypeMisMatch
{
public static void Main()
{
string[] strings = {"one", "two", "three"};
int[] ints = {1, 2, 3};
try
{
Array.Copy(strings, ints, 3);
}
catch(ArrayTypeMismatchException e)
{
Console.WriteLine("Exception: {0}", e);
}
}
}
}
Exception: System.ArrayTypeMismatchException: Source array type cannot be assigned to destination array type. at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length) at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length) at Samples.ArrayTypeMisMatch.Main() in C:\Books\BCL\Samples\System\ ArrayTypeMismatchException\ArrayTypeMismatchException.cs:line 13 ...
Read now
Unlock full access