×
Namespaces

Variants
Actions

Comparing Qt C++, C-Sharp and Visual Basic

From Nokia Developer Wiki
Jump to: navigation, search

This article provides a comparative overview of programming languages used on Nokia Platforms: C# and Visual Basic (Windows Phone), and Qt C++(Symbian and MeeGo).

WP Metro Icon Porting.png
SignpostIcon WP7 70px.png
Article Metadata
CompatibilityArticle
Created: girishpadia (15 Oct 2011)
Updated: girishpadia (15 Oct 2011)
Last edited: hamishwillee (27 Jun 2013)

Contents

Comments

Visual Basic

    'This line is commented

C#

// This line is commented
 
/* This line block is
Commented */

Qt C++ (same as for C#)

// This line is commented
 
/* This line block is
commented */

Data Types

Visual Basic

 Boolean
Byte, SByte
Char
Short, UShort, INTEGER, UInteger, LONG, ULong
SINGLE, DOUBLE
Decimal

C#

 bool
byte, sbyte
char
short, ushort, int, uint, long, ulong
float, double
decimal

Qt

 bool
char
short
int
long
float
double

Variale declarations

Visual Basic

 DIM <variable name> AS <datatype> = [<default Value>]
FOR example
DIM TotalAmount AS LONG=123456

C#

 <datatype> <variable name> = [<default value>]
// example
long Totalamount = 123456

Qt

 <datatype> <variable name> = [<default value>]
// Example
long Totalamount = 123456

Condition statements

Visual Basic

IF <expression> THEN
'Do something
ELSEIF <expression> THEN
'Do something
ELSE
'Do something
END IF

C#

if (<expression>)      
{
// do something if expression is true
}
elseif(<expression>)
{
// do something if expression is true
}
else
{
// do something if expression is false
}

Qt

if (<expression>)      
{
// do something if expression is true
}
else if(<expression>)
{
// do something if expression is true
}
else
{
// do something if expression is false
}


Switch

Visual Basic

 SELECT CASE <data>
CASE <value1>
'Do something
CASE <value2>
'Do something
CASE ELSE
'Do something if non of above case matched
END SELECT

C#

switch (data)
{
case <value1>:
//Do something
break;
case <value2>:
//do something
break;
default:
//do something if non of obove case matched.
break;
}

Qt

switch (data)
{
case <value1>:
//Do something
break;
case <value2>:
//do something
break;
default:
//do something if non of obove case matched.
break;
}

Loops

Visual Basic

 WHILE <expression>
'do something
END WHILE
 
DO WHILE <expression>
'do something
LOOP
 
DO UNTIL <expression>
'do something
LOOP
 
FOR <variable>=<startValue> TO <endValue> STEP <increments>
'do something
NEXT

C#

while (<expression>)
{
// do something
}
do
{
// do something
}while(expression);
for(<variable>=<startValue>;<expression>;<increment>)
{
// do something
}

Qt

while (<expression>)
{
// do something
}
for(<variable>=<startValue>;<expression>;<increment>)
{
// do something
}

Exception handling

Visual Basic

  Try
'do something
catch ex AS Exception
'do something
END Try

C#

  try
{
// do something
}
catch (Exception ex)
{
//do something
}

Qt

  try
{
// do something
}
catch (e)
{
//do something
}
This page was last modified on 27 June 2013, at 07:55.
141 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×