params keyword

  • Thread starter Thread starter michaeltorus
  • Start date Start date
M

michaeltorus

Hi

I'd like to create a function that has a variable amount of Int64 variables passed to it ... however, I'd like them to be passed as ref(so that changes are reflected in the calling method). Is there any way to implement this, so that my function works with a ref param array(or similar object), because currently param arrays cannot be passed as ref ?

Thanks
 
as C# does not support declaring pointers to value types (like an Int64),
except with parameter ref, there is no way without dropping into C++. you
have couple choices.

create you own object type to pass to the method:

classs myInt64
{
public Int64 Value;
public void myInt64(Int64 value)
{
Value = value;
}
}

this will pass by ref (as all objecvts are passed by ref).

you could pass an array, but will have to load an inload in the caller.

-- bruce (sqlwork.com)
 
Back
Top