D
Dr Duck
GDay all,
Something seems odd to me....
I wrote a simple C# function
public void bind(ref object a, ref object b, bool atob)
{
if(atob)
b = a;
else
a = b;
}
I call it from a windows app.
string data = "moo";
bind(ref (object)this.Text, ref (object)data, false);
As I expected I got Error CS1510 "A ref or out argument must be an
lvalue".
Here is what I didnt't expect, when I wrote a vb.net equivilant:
Public Sub bind(ByRef a As Object, ByRef b As Object, ByVal atob As
Boolean)
If (atob) Then
b = a
Else
a = b
End If
End Sub
and call it from a windows app:
Dim data As String = "moo"
bind(Me.Text, data, False)
Not only did it compile it also executed and worked - the forms title
was changed to "moo".
Why does VB.NET not spit the dummy?
Is it possible to coax C# into doing whatever vb did?
-DM
Something seems odd to me....
I wrote a simple C# function
public void bind(ref object a, ref object b, bool atob)
{
if(atob)
b = a;
else
a = b;
}
I call it from a windows app.
string data = "moo";
bind(ref (object)this.Text, ref (object)data, false);
As I expected I got Error CS1510 "A ref or out argument must be an
lvalue".
Here is what I didnt't expect, when I wrote a vb.net equivilant:
Public Sub bind(ByRef a As Object, ByRef b As Object, ByVal atob As
Boolean)
If (atob) Then
b = a
Else
a = b
End If
End Sub
and call it from a windows app:
Dim data As String = "moo"
bind(Me.Text, data, False)
Not only did it compile it also executed and worked - the forms title
was changed to "moo".
Why does VB.NET not spit the dummy?
Is it possible to coax C# into doing whatever vb did?
-DM