Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which language to use: C# or VB.Net
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00605780
Message ID:
00605919
Vues:
20
>Read up on 'operator overloading' which was defined as "the process of creating two or more functions with the same name but with different function signatures. With overloading you can implement functions that react differently based on input type." I dont really understand the data 'type' thing yet other than character, numeric, etc and why all this is different in .Net than VFP. Is operator overloading a big advantage?

I dont mind overloading.
It becomes somewhat nessecary in a Strongly-typed language.
Case-sensitivity can take a little to get used to, but isnt of any real consequence in the end.

and example of overloading, in both VFP and JAVA (I have written in JAVA for uni, I havnt written any C# yet)
Purpose of code is to add two Strings, but handle if the second var is a number, just convert to string... (A poor example, but it was all that came to mind where error checking could be needed)
VFP:
FUNCTION addStrings
LPARAMETERS cStr, vVar
LOCAL retStr
retStr= ""
DO CASE
    CASE VARTYPE(cStr) = "C" AND VARTYPE(vVar) = "C"
         retStr= m.cStr + m.vVar

    CASE VARTYPE(cStr) = "C" AND VARTYPE(vVar) = "N"
         retStr= m.cStr + STR(m.vVar)
ENDIF
RETURN m.retStr

JAVA / C# :
PUBLIC String addStrings(str1 AS String, str2 AS String)
{
    RETURN str1 + str2;
}

PUBLIC String addStrings(str1 AS String, num1 AS Int)
{
    RETURN str1 + String.toString(num1)
}
Obviously this is a poor excuse for an example but displays what I mean...
Also because of String Typing, If I tried to call it with a DATE for example, it wouldnt even compile.
Strong Typing is a good thing, just need to get used to it :)




>
>
>>VB.Net has background compilation, not C#.
>
>Noticed in my reading last night that 'backround compilation' catches syntax errors and such on the fly in the editor as entered. This is good for guys like me.
>
>Also from my .net training tour documentation:
>
>"All .net languages use the same runtime giving them the same performance and feature set. But the languages were designed for different target developers.
>
>VB.Net provides declarative events, dynamic arrays, case insensivity, better com interop, late binding, modules, optional parameters and a backround compiler. These make VB.Net better suited for typical RAD Developers.
>
>C# supports syntax for unsafe pointers,operator overloading, case sensitivity and bitwise shift operations since target users include lower level C developers."
>
>Being a VFP developer, that puts me in the RAD category... Need to learn more about these features to make a good decision.
>
>Thanks again for the input...
>
>Todd
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform