khyberman
asked on
I wan to pass an argument to a C# function by reference that is a User Defined Class
RiskParams risk = null;
IsPartialFill(.... risk);
private bool IsPartialFill(Transaction3 Arb trans, bool addtopendingQ, RiskParams risk)
{
risk = new RiskParam();
}
Please advice on how to accomplish this.
Thx
IsPartialFill(.... risk);
private bool IsPartialFill(Transaction3
{
risk = new RiskParam();
}
Please advice on how to accomplish this.
Thx
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Reference types that are sent in parameters in C# are sent by reference, by default, so in your case I don't think its necessary to use the ref keyword. Its usually used for value types that need to be sent by reference.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Zephyr__ , your first post was correct, and your correction is wrong :(
To create instance inside of function, parameter must be passed by reference. Otherwise created object is not visible to caller.
To create instance inside of function, parameter must be passed by reference. Otherwise created object is not visible to caller.
aha, I wasnt aware of that... your right Alex - thanks for correction