using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace nsClassLibrary
{
public class VBSamples
{
public double RetOneDouble(double GetDouble)
{
double dbl = GetDouble + 11;
return dbl;
}
}
}
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim obj As New nsClassLibrary.VBSamples
MessageBox.Show(obj.RetOneDouble(22))
Me.Close()
End Sub
End Class
struct struTwoDoubles
{
public double GetDbl1, GetDbl2;
}
private struTwoDoubles foo(double dbl1, double dbl2)
{
struTwoDoubles abc = new struTwoDoubles();
abc.GetDbl1 = dbl1 * 2;
abc.GetDbl2 = dbl2 * 3;
return (abc.GetDbl1,abc.GetDbl2);
}
< .. >
The problem comes when I pass two or more doubles/variables, C# it handles it fine, but it cannot return both values back to VB.
< .. >
how about pasing the arguments by reference?
Use output parameters (using the out or ref keywords)
But I haven't had any luck with it...Code: [Select]private struTwoDoubles foo(double dbl1, double dbl2)
{
struTwoDoubles abc = new struTwoDoubles();
abc.GetDbl1 = dbl1 * 2;
abc.GetDbl2 = dbl2 * 3;
return (abc.GetDbl1,abc.GetDbl2);
}
how about pasing the arguments by reference?
Yep :)•Use output parameters (using the out or ref keywords)
Hi,
Another way if you target the Framework 4, is to return a Tuple.
Use a dictionary or key-value pair or tuple as output