Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 6, 2013 19:15
Show Gist options
  • Save Fhernd/5940919 to your computer and use it in GitHub Desktop.
Save Fhernd/5940919 to your computer and use it in GitHub Desktop.
Prueba de la literal null.
class NullPrueba
{
static void Main()
{
Punto punto = null;
Console.WriteLine(punto == null); // True
// Al intentar acceder a un dato miembro del objeto null
// en tiempo de ejecución se generará un error
// (una excepción NullReferenceException se lanza)
Console.WriteLine(punto.X);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment