-4

how can i implement this Pseudocode without return in c#(because i want to use it in button event handler)?thanks

edited:

 large_int example(large_int u,large_int v)

  {
     .
     .       
     .////some codes
     .
        x=u divide 10^2;
        w=v divide 10^2;
 return example(x,w)///it means when example(x,w) returns, x replace with u and w replace with v
}
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
Arash
  • 3,013
  • 10
  • 52
  • 74
  • What do you mean, "without return" ? What do you want to do with the result ? – Thomas Levesque Dec 19 '10 at 20:51
  • return example(x,w) means when example(x,w) returns, x replace with u and w replace with v – arash 8 hours ago i want to do this work without using return – Arash Dec 20 '10 at 06:03

2 Answers2

3

You could pass in a variable that has to be set within the method.

MSDN on C# out keyword

Novikov
  • 4,399
  • 3
  • 28
  • 36
  • think i didnt say my question clearly,please see my edited question,x and w are the values that used in example() and they arent new,with your code i cant use x and w – Arash Dec 19 '10 at 21:28
  • return example(x,w) means when example(x,w) returns, x replace with u and w replace with v – Arash Dec 19 '10 at 21:42
1

You could make the method void, perform the same logic, and update something on your UI based on the result of the operation.

Not sure if you mean for ASP.NET, but if you do...

<asp:Button ID="myButton" Text="Do Stuff" runat="server" OnClick="My_Event_Method" />

protected void My_Event_Method(object sender, EventArgs e)
{
    example(someArg, someArg2);
}

private void example(int u, int v)
{
    // perform logic here and update your UI
}
Tyler Treat
  • 14,640
  • 15
  • 80
  • 115