Show structure member field value - CSharp Custom Type

CSharp examples for Custom Type:struct

Description

Show structure member field value

Demo Code

using System;//  w w  w. j  a va 2  s. com
public struct Simple {
   public  int i;
   private string s;
   public void init( ) {
      i = 10;
      s = "Hello";
   }
   public void show( ) {
      Console.WriteLine("i = {0}", i);
      Console.WriteLine("s = {0}", s);
   }
}
public class T {
   public static void Main( ) {
      Simple simple = new Simple( );
      simple.init( );
      simple.show();
   }
}

Result


Related Tutorials