Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert constants from vb to c#

Tags:

c#

.net

vb.net

There are a bunch of constants like vbTab in VB.Net, is there corresponding one in C# ?

like image 895
user496949 Avatar asked Nov 28 '10 02:11

user496949


People also ask

Can you convert VB.NET to C#?

Code Converter (VB - C#)Adds context menu items to convert projects/files between VB.NET and C#. Flexible: Convert a small selection, or a whole solution in one go, in either direction. Accurate: Full project context (through Roslyn) is used to get the most accurate conversion.

How do you convert variables to constants?

There is nothing like "convert some variable to constant" as constants are compile time value. If you want the values in integer array to be non-changable once it is set, consider using a ReadOnlyCollection<int> instead.

What is vbLf in C#?

Represents a linefeed character for print and display functions. public: System::String ^ vbLf; C# Copy.

How do you check if a variable is null in VB?

This example uses the IsNull function to determine if a variable contains a Null. Dim MyVar, MyCheck MyCheck = IsNull(MyVar) ' Returns False. MyVar = "" MyCheck = IsNull(MyVar) ' Returns False. MyVar = Null MyCheck = IsNull(MyVar) ' Returns True.


1 Answers

There is not an exact corresponding set of constants oriented for C#. Certain constants are simply represented in string form (e.g., "\t" for vbTab).

I would suggest not referencing the Microsoft.VisualBasic assembly to use those constants. That namespace mainly exists to support migration of legacy VB6 applications.

like image 71
Phil Hunt Avatar answered Sep 27 '22 23:09

Phil Hunt