Visual Basic needs more credit
-
That code doesn't fail
-
As well there shouldn't be. C# doesn't need it.
You'll never get very far if all you do is follow instructions.
Considering the missing connection between me knowing C# can get away without using the with word, proves its problems. The with keyword gets the coder in a mindset.
-
I do miss the with operator. I have cases where it could save hundreds of characters and make it way easier to read. Don't listen to the C# purists. :zzz:
There are only 10 types of people in the world, those who understand binary and those who don't.
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
-
See my answer to your other post - you don't need the
With
operator in C# for object or collection initializers.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
this message is spam
-
If pictures is null the memory space creates itself and returns a empty album list
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
-
I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:
Private Sub AlbumListPopulate()
Try
AlbumsList.ItemsSource = New List(Of Image)For Each AlbumName In Pictures.Albums Try AlbumsList.ItemsSource.Add \_ ( New Image With { .Height = 150, .Width = 150, .Source = RotateStream \_ ( Pictures.Album(AlbumName).Picture, Pictures.Album(AlbumName).Angle ) } ) Catch End Try Next Catch End Try
End Sub
If you'd picked a case of With doing namespace/object elision, you might have a point. But as several people have pointed out, this is an object initialiser which is included in C# and (I think) has been since the same .Net compiler version as the VB.Net syntax you're demonstrating. Other languages like JavaScript, Ruby, Perl etc can create objects with data in a single statement like this, too, and have been able to for years. If you're going to make a claim like "no other language can do [something your fave can]" then at least a tiny bit of research would be a good idea.
-
Just because you don't need the extra keyword doesn't mean that C# can't do it:
new Image
{
Height = 150,
Width = 150,
Source = RotateStream
(
Pictures.Album[AlbumName].Picture,
Pictures.Album[AlbumName].Angle
)
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
That code would fail as the scopes would be confused
-
If you'd picked a case of With doing namespace/object elision, you might have a point. But as several people have pointed out, this is an object initialiser which is included in C# and (I think) has been since the same .Net compiler version as the VB.Net syntax you're demonstrating. Other languages like JavaScript, Ruby, Perl etc can create objects with data in a single statement like this, too, and have been able to for years. If you're going to make a claim like "no other language can do [something your fave can]" then at least a tiny bit of research would be a good idea.
Without the with operator C# has a smaller scope
-
I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the
On Error Resume
abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!Wrong is evil and must be defeated. - Jeff Ello[^]
I took a job once, with no knowledge of VB (Visual Studio 6). Hey, I just wanted a well paying part time job to finish my master's degree. One of the 'best practices' of the company was to always add "On Error Resume Next" at the beginning of each and every function. I asked why, and the reply was that it just works better that way. The job paid the bills, I graduated, I got a new job, the company went under (not because I left, but I saw the writing on the wall ahead of time - they had too many people and no contracts lined up).
-
I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the
On Error Resume
abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!Wrong is evil and must be defeated. - Jeff Ello[^]
I should have left out the try catch
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
With, when used appropriately, aids clarity just by removing characters – if you have to read past "SomeLongObjectName." at the start of every line you won't actually see the important word. When used badly (so you don't know whether the tokens on the line are part of the with'd object or locals or something else) it makes things worse. I've used with in ActionScript, usually for graphics code which is doing nothing but a bunch of calls to lineTo, moveTo, setBitmapFill etc, and (imo anyway) not having "e.graphics." on every line makes that clearer.
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
-
and you can do the same in C# without the need for "with" keyword
Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
Without the with keyword in C# it reduces the available scope
-
With his pants on fire :laugh: I read somewhere that there are things that VB can do and C# can't an vice versa though... Think it had something to do with Errorhandling ?
No
-
Considering the missing connection between me knowing C# can get away without using the with word, proves its problems. The with keyword gets the coder in a mindset.
That may be part of the problem...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
-
I totally agree on that most of the complaints about VB is of the immature kind. But one thing I need to give them is the
On Error Resume
abomination. Which you sadly have emulated with your empty Catch. :sigh: My personal opinion is that since C# and VB.Net is based on the same CLR and the same Framework, most quarrels are just silly. Use what you feel most at home with, but stop being ridiculous about it!Wrong is evil and must be defeated. - Jeff Ello[^]
I should have left out the try catch
-
RyanDev wrote:
and make it way easier to read
I would argue the opposite.
You'll never get very far if all you do is follow instructions.
visual basic takes less skill to get the job done
-
I think that Visual Basic should be shown off for its beauty and elegance. Here is a sample of what it can do - that no other language can do:
Private Sub AlbumListPopulate()
Try
AlbumsList.ItemsSource = New List(Of Image)For Each AlbumName In Pictures.Albums Try AlbumsList.ItemsSource.Add \_ ( New Image With { .Height = 150, .Width = 150, .Source = RotateStream \_ ( Pictures.Album(AlbumName).Picture, Pictures.Album(AlbumName).Angle ) } ) Catch End Try Next Catch End Try
End Sub
If I could be arsed, I'd find similar classes in Java and show you how anonymous constructors work there too.
-
A lot of people do. I can't understand why, but yes, a lot of people do.
There are only 10 types of people in the world, those who understand binary and those who don't.
visual basic is easier for people with less skill