Advertisement
Fhernd

thisUsoEnEstructura.cs

Jul 25th, 2014
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Preguntas
  4. {
  5.     public struct UsoThisEnEstructura
  6.     {
  7.         private int campo;
  8.        
  9.         public UsoThisEnEstructura(int valor)
  10.         {
  11.             this.campo = valor;
  12.         }
  13.        
  14.         public void Metodo(int a)
  15.         {
  16.             this.campo = a;
  17.            
  18.             Console.WriteLine(campo.ToString());
  19.            
  20.             this = new UsoThisEnEstructura(9);
  21.            
  22.             Console.WriteLine(campo.ToString());
  23.         }
  24.        
  25.         public static void Main()
  26.         {
  27.             UsoThisEnEstructura ut = new UsoThisEnEstructura(3);
  28.            
  29.             ut.Metodo(4);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement