|
-
Apr 7th, 2003, 05:04 AM
#1
Thread Starter
Fanatic Member
Why VB.NET doesn't have ++ ?
I wonder why ++ operator is missing in VB.NET where as we have other C equivalents like += +* etc..
Any guess???
In one book I read that Microsoft thought ++ will complicate the code! Then why not the same for +/ etc??
Life is a one way journey, not a destination. Travel it with a smile and never regret anything.
Yesterday is history, tomorrow is a mystery, today is gift - that's why we call it present.
-
Apr 7th, 2003, 05:49 AM
#2
Frenzied Member
Post and preincrement are bad coding practice.
This is because the second parameter is implied.
Use +=1 instead.
-
Apr 7th, 2003, 08:52 AM
#3
Sleep mode
Talking about Cs , ++ is used in C# with For loops like this :
int i;
for (i=1 ; i <=10 ; i++) {
Console.WriteLine("Number : " , i);
the output is :1 through 10 .
-
Apr 7th, 2003, 10:25 AM
#4
PowerPoster
Originally posted by MerrionComputin
Post and preincrement are bad coding practice.
This is because the second parameter is implied.
Use +=1 instead.
??? Bad coding practice? Since when? I have been using it for a long time. All my C++ and C# books use it, even the MSDN library uses it. Where do you get this is bad coding practice.
-
Apr 7th, 2003, 02:06 PM
#5
PowerPoster
Yah, why not use i+=1 it's the same thing.
int i;
for (i=1 ; i <=10 ; i+=1) {
Console.WriteLine("Number : " , i);
}
the output is :1 through 10 .
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Apr 7th, 2003, 02:46 PM
#6
PowerPoster
Originally posted by Arc
Yah, why not use i+=1 it's the same thing.
int i;
for (i=1 ; i <=10 ; i+=1) {
Console.WriteLine("Number : " , i);
}
the output is :1 through 10 .
You can do it, but the ++ operator can be used in other means besides incrementing a counter variable by 1. You can overload the operator in your C# class, and use it on an object. Such as if you had a object type that overloads the operator, you could have that object increment anything in the object, such as a property, value, etc.
Therefor, using the i +=1 doesn't work in all situations, just the value types like integer. Maybe you want to do a for loop through an object or something.
Basically, it provides some flexibility when programming, and that I welcome.
One last reason to use ++ instead of +=1, less typing...lol.
-
Apr 7th, 2003, 02:58 PM
#7
Sleep mode
hellswraith , I overloaded three voids in my C# class without any operators . How can you do that with ++ operators ?
-
Apr 7th, 2003, 03:17 PM
#8
PowerPoster
-
Apr 7th, 2003, 04:07 PM
#9
Sleep mode
I don't get it hellswraith !! . Better I didn't use them in my voids .
-
Apr 7th, 2003, 04:37 PM
#10
PowerPoster
In your voids?
What are you talking about? Show me an example.
-
Apr 8th, 2003, 02:04 AM
#11
Sleep mode
How can I overloads a function in C# with operators ? It seems not obligatory but preferable .
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|