|
 |
aspx_espanol thread: Diferencias en sintaxis entre C#, VB.NET, y JScript.NET
Message #1 by "Juan T. Llibre" <j.llibre@c...> on Thu, 14 Dec 2000 14:10:51 -0500
|
|
Algunas muestras de diferencias de sintaxis
entre C#, VB.NET y JScript.NET :
C# :
int x;
String s;
String s1, s2;
Object o;
Object obj = new Object();
public String nombre;
VB.NET :
Dim x As Integer
Dim s As String
Dim s1, s2 As String
Dim o 'Objeto Implícito
Dim obj As New Object()
Public nombre As String
JScript.NET :
var x : int;
var s : String;
var s1 : String, s2 : String;
var o;
var obj : Object = new Object();
var nombre : String;
-----------
C# :
String s = Request.QueryString["Nombre"];
String value = Request.Cookies["clave"];
VB.NET :
Dim s, valor As String
' note la declaración común de tipo ( String )
' cuando las variables estan en la misma línea
' porque tanto "s" como "valor" son de tipo "String"
' Si fueran de tipo distinto, habría que declarar sus tipos por separado
' por ejemplo :
' Dim i As Integer
' Dim valor As String
s = Request.QueryString("Nombre")
valor = Request.Cookies("Clave").Value
' note que las propiedades con valores por defecto
' tienen que ser declaradas explícitamente en VB
' ya no se usará : valor = Request.Cookies("Clave")
, ni tampoco : valor = Request("Clave")
JScript.NET :
var s : String = Request.QueryString("Nombre");
var value : String = Request.Cookies("clave");
---------
C# :
String[] a = new String[3];
a[0] = "1";
a[1] = "2";
a[2] = "3";
String[][] a = new String[3][3];
a[0][0] = "1";
a[1][0] = "2";
a[2][0] = "3";
VB.NET :
Dim a(3) As String
a(0) = "1"
a(1) = "2"
a(2) = "3"
Dim a(3,3) As String
a(0,0) = "1"
a(1,0) = "2"
a(2,0) = "3"
JScript.NET :
var a : String[] = new String[3];
a[0] = "1";
a[1] = "2";
a[2] = "3";
var a : String[][] = new String[3][3];
a[0][0] = "1";
a[1][0] = "2";
a[2][0] = "3";
Seguiremos enviando ejemplos...
saludos,
Juan T. Llibre
Moderador, ASP.NET en Español
Microsoft MVP [IIS/ASP]
ASP Resource : http://asptracker.com/
ASP en Español : http://aspespanol.com/
==================================
---
Usted está suscrito a aspx_espanol como:
$subst('Recip.EmailAddr')
Para darse de baja, envíe un mensaje en blanco a
leave-aspx_espanol-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by =?iso-8859-1?Q?Hassan_Arteaga_Rodr=EDguez?= <hassan@c...> on Thu, 14 Dec 2000 14:01:56 -0600
|
|
Viva !!!!
Por esto empezamos !!!
Gracias por los ejemplos..
Salu2
--
************************************
M. Sc. Hassan Arteaga Rodríguez
Microsoft Certified System Engineer
COPEXTEL, S.A. Cienfuegos
e-mail: hassan@c...
************************************
----- Original Message -----
From: Juan T. Llibre <j.llibre@c...>
Newsgroups: aspx_espanol
To: ASP.Net en Español <aspx_espanol@p...>
Sent: Thursday, December 14, 2000 1:10 PM
Subject: [aspx_espanol] Diferencias en sintaxis entre C#, VB.NET, y
JScript.NET
> Algunas muestras de diferencias de sintaxis
> entre C#, VB.NET y JScript.NET :
>
> C# :
> int x;
> String s;
> String s1, s2;
> Object o;
> Object obj = new Object();
> public String nombre;
>
> VB.NET :
> Dim x As Integer
> Dim s As String
> Dim s1, s2 As String
> Dim o 'Objeto Implícito
> Dim obj As New Object()
> Public nombre As String
>
> JScript.NET :
> var x : int;
> var s : String;
> var s1 : String, s2 : String;
> var o;
> var obj : Object = new Object();
> var nombre : String;
> -----------
>
> C# :
> String s = Request.QueryString["Nombre"];
> String value = Request.Cookies["clave"];
>
> VB.NET :
> Dim s, valor As String
> ' note la declaración común de tipo ( String )
> ' cuando las variables estan en la misma línea
> ' porque tanto "s" como "valor" son de tipo "String"
> ' Si fueran de tipo distinto, habría que declarar sus tipos por separado
> ' por ejemplo :
> ' Dim i As Integer
> ' Dim valor As String
> s = Request.QueryString("Nombre")
> valor = Request.Cookies("Clave").Value
> ' note que las propiedades con valores por defecto
> ' tienen que ser declaradas explícitamente en VB
> ' ya no se usará : valor = Request.Cookies("Clave")
> , ni tampoco : valor = Request("Clave")
>
> JScript.NET :
> var s : String = Request.QueryString("Nombre");
> var value : String = Request.Cookies("clave");
> ---------
>
> C# :
> String[] a = new String[3];
> a[0] = "1";
> a[1] = "2";
> a[2] = "3";
>
> String[][] a = new String[3][3];
> a[0][0] = "1";
> a[1][0] = "2";
> a[2][0] = "3";
>
> VB.NET :
> Dim a(3) As String
> a(0) = "1"
> a(1) = "2"
> a(2) = "3"
>
> Dim a(3,3) As String
> a(0,0) = "1"
> a(1,0) = "2"
> a(2,0) = "3"
>
> JScript.NET :
> var a : String[] = new String[3];
> a[0] = "1";
> a[1] = "2";
> a[2] = "3";
>
> var a : String[][] = new String[3][3];
> a[0][0] = "1";
> a[1][0] = "2";
> a[2][0] = "3";
>
>
> Seguiremos enviando ejemplos...
>
> saludos,
>
>
> Juan T. Llibre
> Moderador, ASP.NET en Español
> Microsoft MVP [IIS/ASP]
> ASP Resource : http://asptracker.com/
> ASP en Español : http://aspespanol.com/
> ==================================
>
>
>
> ---
> Usted está suscrito a aspx_espanol como:
> hassan@c...
> Para darse de baja, envíe un mensaje en blanco a
> leave-aspx_espanol-$subst('Recip.MemberIDChar')@p2p.wrox.com
>
>
---
Usted está suscrito a aspx_espanol como:
$subst('Recip.EmailAddr')
Para darse de baja, envíe un mensaje en blanco a
leave-aspx_espanol-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |