Hello, I have a problem understanding why this piece of code:
using System;
class Person
{
public Person()
{
}
}
class NameApp
{
public static void Main()
{
Person me = new Person();
Object you = new Object();
me = you as Person;
//me = (Person) you;
System.Console.WriteLine("Type: {0}", me.GetType()); //This line throws exception
}
}
Throws this exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at NameApp.Main() in C:\Users\Nenad\documents\visual studio 2010\Projects\Exercise 11.3\Exercise 11.3\Program.cs:line 21
you as Personto do?