Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some C# questions.
Message
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01181975
Message ID:
01184310
Views:
19
>>>You know whats freaking me out about C# right now?
>>>It's that user define variables come with what seems like a built in function and properties like
>>>
>>>MyVariable.ToString();
>>>MyVariable.Length;
>>>
>>>
>>>But why is Length a property and ToString a function?
>>
>>ToString is an action. Length is an aspect.
>>
>>I figured it out this way. You can add more actions on top of actions. But you can't the same idea to an aspect.
>>
>>string myString = "It's that user define variables come with what seems like a built in function and properties like"
>>
>>this.txtBox1.Text = myString.SubString(0,someLen).Upper().ToString();
>
>Thanks.
>
>To me
>
>lcMyStr = STR(MyNumericValue)
>or
>lnLength = LEN(MyStrValue)
>
>seems natural. You got your function calls with parameter.
>
>But this...
>
>MyNumericValue.ToString()
>or
>MyStrValue.Length()
>
>is just too freaky. Kinda reminds me of VB6 "Me.Something".
>It just isn't right. :)


Unfortunately it's just not what you are use to. FP & VFP didn't start it properly nor fix it in it's "visual" adaptation.

A quick look at other languages and you will find that :
lnLength = LEN(MyStrValue) is just wrong.
int lnLength = MyStrValue.Length

The reason it's wrong from my POV is that you keep putting functions within functions instead of complementing one with another.

string myString = "You have to be kidding"

string MYSTRING = myString.Upper().

It prevents you from putting this inside:
Var =159
lcString = upper(myString+", "+Var)

Your compiler won't catch that.

It's a lot to cross learn, and as you do you realize that VFP is quirky from a language POV and why few shops would adopt it today.
Previous
Reply
Map
View

Click here to load this message in the networking platform