Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 21, 2014 23:31
Show Gist options
  • Save Fhernd/414235fce7a3094ba934 to your computer and use it in GitHub Desktop.
Save Fhernd/414235fce7a3094ba934 to your computer and use it in GitHub Desktop.
Uso de this en un miembro función de una estructura.
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