Rohan M

Rohan M

  • NA
  • 7
  • 0

Problem with structure

Jun 2 2007 10:06 AM

Hi to all, Plz help me
Can we assign the intger value in an object again and again?

using System;

struct MyStruct

{

   public int x = 25;

   public void SetX(int i)

   { x = i; }

}

class MyClient

{

 public static void Main()

  {

    MyStruct ms = new MyStruct();

    ms.SetX(100);

  // Store this object somewhere(say arraylist) then again collect this object and

  // assign different value. 

    ms.SetX(102);

  }

}


Answers (4)