Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created October 5, 2013 02:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/6835886 to your computer and use it in GitHub Desktop.
Save Fhernd/6835886 to your computer and use it in GitHub Desktop.
Demostración del uso del modificador de campo readonly en C#.
class Edad
{
readonly int agnioNacimiento;
public Edad(int agnio)
{
agnioNacimiento = agnio;
}
public void CambiarAgnioNacimiento(int agnio)
{
// La siguiente sentencia causará error de compilación
// agnioNacimiento = agnio;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment