|
Public Property Something As String
Get
Return _Something
End Get
Set(value As String)
_Something = value
End Set
End Property
public string Something
{
get
{
return _Something;
}
set
{
_Something = value;
}
} That's eight vs. eleven lines. It adds up!
I always find VB has a vertical cleanliness whereas C# has a horizontal cleanliness
I love both languages by the way. It's just a little bit easier to write messy code in VB due to backwards compatibility with VB1-6, but you can write utter crap in both languages any language!
Started out in VB.NET and later moved to C#.
|
|
|
|
|
In your example, VB has 20 keywords, variable names, etc. C# has 9. Nuff said
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
But still less vertical space!
|
|
|
|
|
Sander Rossel wrote: But still less vertical space!
public string Something
{
get { return _Something; }
set { _Something = value; }
} Where, exactly?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Yep, that's how I would write simple getters and setters. I only go multiline if there's some additional logic in there
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
In VB.NET you could type only
Public String Something
variable _Someting would be internally created and accessible without explicit definition. I don't know if they added it in C# too..
While there are more keywords, intellisense is better and there is actually less typing in vb version
|
|
|
|
|
|
VB? I see why you're ashamed!
veni bibi saltavi
|
|
|
|
|
expected ';'
|
|
|
|
|
When it is just so very easy?
Select Case word
Case "JULY"
Return 7
End Select
|
|
|
|
|
Maybe because if you used mixed case (July) it would fail, or be hard for the original author to determine what the issue was?
|
|
|
|
|
"because it requires a recompile to update the values"
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Nothing is removed from the snippet- it really can only deal with JULY.
|
|
|
|
|
Where is that sarcasm icon when it's needed most?
|
|
|
|
|
Maybe the TDDers never got round to writing the tests for other strings - therefore they weren't allowed to change it!
|
|
|
|
|
Almost each project has them.
It gets better if there's a concatenation going on of constants into a stringbuilder.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
That's the one to watch for these days..
Your product may only be intended to English speaking nations (although there are differences even between these), but eventually some bright spark of a salesman's going to drop everyone in it selling a version to Beijing or some other exotic location
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
oh, now this is fun.
July and july for starters, but you can have other languages as well. In dutch it's pretty straightforward "juli", but in French that becomes juillet, spanish=julio and croatian apparently returns "srpanj"
|
|
|
|
|
I challenge you to pronounce you if you're not slavic (I am, btw)
R in sRpanj is hard as when the russian speaks english in movies and nj is single letter pronounced like New without U
|
|
|
|
|
I did before I read your explanation, do I win a cookie?
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
...and in polish: "lipiec"
|
|
|
|
|
I was a bit mystified why property change notifications (INotifyPropertyChanged ) were being raised for non-existent properties in our project.
Turns out some "bright spark" had the innovative idea of using them as a general event mechanism, presumably to save all the effort of declaring an event type.
I may have to persuade the company to buy all developers a copy of "Clean Code".
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|