Saturday, May 22, 2010

Visual C#?

In Visual basic you can have a custom Type Like So:





type MyType


A as integer


B as integer


end type





How do you make a type in C#? Give me an example using above data.

Visual C#?
There are two ways you can do that. One is a class, the other is a struct depending how you want to use them.
Reply:In VB, you declares variables using the syntax


Dim [ variable ] as [ datatype ]





Example :


Dim name as String


Dim price as Double


Dim number as Integer.





For C#, the syntax is [datatype] space [ valuable.]. And the datatype is in small cap





Example:


string name;


double price;


int number;





Hope this is helps.
Reply:You really should look up C# references. If you don't have a book, MSDN will explain it. Or a tutorial. Or google. In any case, the form is





type variablename so you would have:





int A;


int B;


No comments:

Post a Comment