I use this to create a dynamic object in Visual Basic before sending it as an JSON
Dim my_object = New With { _
.Name = String.Empry, _
.Telephone = String.Empry, _
.ID = String.Empry
}
How can this be done in C#?
I use this to create a dynamic object in Visual Basic before sending it as an JSON
Dim my_object = New With { _
.Name = String.Empry, _
.Telephone = String.Empry, _
.ID = String.Empry
}
How can this be done in C#?
That is an anonymous Type.
var my_object = new
{
Name = string.Empty,
Telephone = string.Empty,
ID = string.Empty
};
However, note that Stackoverflow is not a translation service normally.
Use this site instead: http://www.developerfusion.com/tools/convert/vb-to-csharp/
If you mean creating an instance of an anonymous type:
var my_object = new {
Name = string.Empty,
Telephone = string.Empty,
ID = string.Empty
};