Accueil     Commander     Clients     Téléchargements     Contacts     I-mode        Offre spéciale
   Hébergement ASP-PHP
      Pack PRO I
      Pack PRO II
      Pack PRO III
   Hébergement .NET
      Pack .NET I
      Pack .NET II
      Pack .NET III
   Revendeurs
      SEMI-DEDIE I
      SEMI-DEDIE II
      SERVEURS DEDIES
   Services
      NOM DE DOMAINE
      HTTPS & SSL
      E-COMMERCE
      SQL SERVEUR
      WEBMAIL
      REFERENCEMENT
   Les + Prosygma
      NOS TARIFS
      LE RESEAU
      ASSISTANCE
   Outils
      WHOIS
      FAQ
      Aide IIS
      Ressource KIT FP
      Composants ASP
     PARTENAIRES
     
     
     

Solutions hébergement
Support Dot NET.
  
  Source : Les laboratoires Microsoft

 

Prise en charge des langages

La plate-forme Microsoft .NET offre actuellement une prise en charge intégrée pour trois langages :
C#, Visual Basic et JScript.

Les exercices et les exemples de code de ce didacticiel montrent comment créer des applications .NET
à l'aide de C#, Visual Basic et JScript. Pour plus d'informations sur la syntaxe des autres langages,
consultez la documentation du Kit de développement .NET Framework SDK.

L'objectif du tableau suivant est de vous aider à comprendre les exemples de code de ce didacticiel
et à identifier les différences entre les trois langages :

Déclarations de variables


Dim x As Integer
Dim s As String
Dim s1, s2 As String
Dim o 'Implicitly Object
Dim obj As New Object()
Public name As String
C# VB JScript  

Instructions


Response.Write("foo")
C# VB JScript  

Commentaires


' This is a comment

' This
' is
' a
' multiline
' comment


C# VB JScript  

Accès aux propriétés indexées


Dim s, value As String
s = Request.QueryString("Name")
value = Request.Cookies("Key").Value

'Note that default non-indexed 
properties 'must be explicitly named in VB
C# VB JScript  

Déclaration de propriétés indexées


' Default Indexed Property
Public Default ReadOnly Property 
DefaultProperty(Name As String) As String Get Return CStr(lookuptable(name)) End Get End Property
C# VB JScript  

Déclaration de propriétés simples


Public Property Name As String

  Get
    ...
    Return ...
  End Get

  Set
    ... = Value
  End Set

End Property
C# VB JScript  

Déclaration et utilisation d'une énumération


' Declare the Enumeration
Public Enum MessageSize

    Small = 0
    Medium = 1
    Large = 2
End Enum

' Create a Field or Property
Public MsgSize As MessageSize

' Assign to the property using
the Enumeration values MsgSize = small
C# VB JScript  

Énumération d'une collection


Dim S As String
For Each S In Coll
 ...
Next
C# VB JScript  

Déclaration et utilisation de méthodes


' Declare a void return function
Sub VoidFunction()
 ...
End Sub

' Declare a function that returns a value
Function StringFunction() As String
 ...
    Return CStr(val)
End Function

' Declare a function that takes 
and returns values Function ParmFunction(a As
String, b As String) As String ... Return CStr(A & B) End Function ' Use the Functions VoidFunction() Dim s1 As String = StringFunction() Dim s2 As String =
ParmFunction("Hello", "World!")
C# VB JScript  

Attributs personnalisés


' Stand-alone attribute
<STAThread>

' Attribute with parameters
<DllImport("ADVAPI32.DLL")>

' Attribute with named parameters
<DllImport("KERNEL32.DLL",
CharSet:=CharSet.Auto)>
C# VB JScript  

Tableaux


    Dim a(2) As String
    a(0) = "1"
    a(1) = "2"
    a(2) = "3"

    Dim a(2,2) As String
    a(0,0) = "1"
    a(1,0) = "2"
    a(2,0) = "3"
C# VB JScript  

Initialisation


Dim s As String = "Hello World"
Dim i As Integer = 1
Dim a() As Double = { 3.00, 4.00, 5.00 }
C# VB JScript  

Instructions If


If Not (Request.QueryString = Nothing)
  ...
End If
C# VB JScript  

Instructions Case


Select Case FirstName
  Case "John"
    ...
  Case "Paul"
    ...
  Case "Ringo"
    ...
  Case Else
    ...
End Select




C# VB JScript  

Boucles For


  Dim I As Integer
  For I = 0 To 2
    a(I) = "test"
  Next
C# VB JScript  

Boucles While


Dim I As Integer
I = 0
Do While I < 3
  Console.WriteLine(I.ToString())
  I += 1
Loop
C# VB JScript  

Gestion des exceptions


Try
    ' Code that throws exceptions
Catch E As OverflowException
    ' Catch a specific exception
Catch E As Exception
    ' Catch the generic exceptions
Finally
    ' Execute some cleanup code
End Try
C# VB JScript  

Concaténation des chaînes


' Using Strings
Dim s1, s2 As String
s2 = "hello"
s2 &= " world"
s1 = s2 & " !!!"

' Using StringBuilder class for performance
Dim s3 As New StringBuilder()
s3.Append("hello")
s3.Append(" world")
s3.Append(" !!!")
C# VB JScript  

Délégués de gestionnaire d'événements


Sub MyButton_Click(Sender As Object,
                   E As EventArgs)
...
End Sub
C# VB JScript  

Déclaration d'événements


' Create a public event
Public Event MyEvent(Sender as 
Object, E as EventArgs) ' Create a method for firing the event Protected Sub OnMyEvent(E As EventArgs) RaiseEvent MyEvent(Me, E) End Sub
C# VB JScript  

Ajout et suppression de gestionnaires d'événements à des événements


AddHandler Control.Change, AddressOf 
Me.ChangeEventHandler RemoveHandler Control.Change,
AddressOf Me.ChangeEventHandler
C# VB JScript  

Casting


Dim obj As MyObject
Dim iObj As IMyObject
obj = Session("Some Value")
iObj = CType(obj, IMyObject)
C# VB JScript  

Conversion


Dim i As Integer
Dim s As String
Dim d As Double

i = 3
s = i.ToString()
d = CDbl(s)

' See also CDbl(...), CStr(...), ...
C# VB JScript  

Définition de classes avec héritage


Imports System

Namespace MySpace

  Public Class Foo : Inherits Bar

    Dim x As Integer

    Public Sub New()
      MyBase.New()
      x = 4
    End Sub

    Public Sub Add(x As Integer)
      Me.x = Me.x + x
    End Sub

    Overrides Public Function
GetNum() As Integer Return x End Function End Class End Namespace ' vbc /out:libraryvb.dll /t:library ' library.vb
C# VB JScript  

Implémentation d'une interface


Public Class MyClass : 
Implements IEnumerable ... Function IEnumerable_GetEnumerator()
As IEnumerator
Implements IEnumerable.GetEnumerator ... End Function End Class
C# VB JScript  

Définition de classes avec une méthode Main


Imports System

Public Class ConsoleVB

  Public Sub New()
    MyBase.New()
    Console.WriteLine("Object Created")
  End Sub

  Public Shared Sub Main()
    Console.WriteLine("Hello World")
    Dim cvb As New ConsoleVB
  End Sub

End Class

' vbc /out:consolevb.exe /t:exe console.vb
C# VB JScript  

Module standard


Imports System

Public Module ConsoleVB

  Public Sub Main()
    Console.WriteLine("Hello World")
  End Sub

End Module

' vbc /out:consolevb.exe /t:exe console.vb
C# VB JScript  



Nos serveurs sont désormais des serveurs
Pentium 3 Ghz, 1 Go Ram

 La formule de base est à 10 Euros TTC / mois
Si vous avez des besoins plus spécifiques (composants, espace disque...), nous sommes la pour répondre à vos questions.
Rappel : les frais d'installation sont gratuits


Prosygma élu meilleur site.
 
Trois nouveaux composants ASP sont désormais en place sur toutes nos formules.Il s'agit de ASPIMAGE, ASPPOP3 et ASPMAIL.


La dernière version de Microsoft® .NET Framework contient tout ce qu'il vous faut pour faire fonctionner des applications .NET Framework est disponible sur nos serveurs

Cliquez içi pour commander votre hébergement .Net

Votre nom de domaine en .com, .net ou .org au prix unique : 20 Euros

  Vérifiez la disponibilité d'un nom de domaine