Last post Oct 01, 2009 05:09 AM by integrasol
Sep 30, 2009 12:46 PM|TaylorDCIS|LINK
I have been developing in VB.net for a cople of years now. I really miss the increment and decrement operators for integers that I grew attached to while using Java and C#. I have seen posts explaining how to implement a custom operator for a class that
I have written, but I have not seen any examples of how to do it for a basic type like Integer. Is it possible? If so, what would I need to do?
Every time I talk about missing the ++/-- operators the first thing I hear is "well all you have to do is i += 1". This obvisouly works and has gotten me this far, but sometimes I would like to do things with pairs of objects in the same statement such as:
For i as Integer = 0 to args.Count - 1
cmdSQL.Parameters.Add(New SqlParameter(Ctype(args(i), String), args(i + 1)))
i += 2
I know I would only save one line of code with the increment operator, but it would look cleaner to me
Thanks for any help.
Oct 01, 2009 05:09 AM|integrasol|LINK
Have you looked into extensions, a new feature of the .NET Framework 3.5? Here's an example of extending the System.String type,