Created
June 21, 2014 23:31
-
-
Save Fhernd/414235fce7a3094ba934 to your computer and use it in GitHub Desktop.
Uso de this en un miembro función de una estructura.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Articulos.Preguntas | |
{ | |
public struct UsoThisEnEstructura | |
{ | |
private int campo; | |
public UsoThisEnEstructura(int valor) | |
{ | |
this.campo = valor; | |
} | |
public void Metodo(int a) | |
{ | |
this.campo = a; | |
Console.WriteLine(campo.ToString()); | |
this = new UsoThisEnEstructura(9); | |
Console.WriteLine(campo.ToString()); | |
} | |
public static void Main() | |
{ | |
UsoThisEnEstructura ut = new UsoThisEnEstructura(3); | |
ut.Metodo(4); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment