VB.Net - With End Block

There is no direct equivalent to this in C#

oHttpWebRequest.Method = "GET"; 
oHttpWebRequest.TimeOut = 10000

You can use object initializers

MyClass myObject = new SuperHero(); 
myObject = new MyClass() {Name="Text", Value=3 }

With oHttpWebRequest 
.Method = "GET"
.TimeOut = 10000
End With


Dim myObject As MyClass; 
myObject = New MyClass;

With myObject
.Name = "Text"
.Value = 3
End With

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext