Moderators Robby Posted December 5, 2002 Moderators Posted December 5, 2002 On a slightly different note, does Try/Catch use more resources? Quote Visit...Bassic Software
*Gurus* Derek Stone Posted December 5, 2002 *Gurus* Posted December 5, 2002 Compared to what? Quote Posting Guidelines
Moderators Robby Posted December 5, 2002 Moderators Posted December 5, 2002 Compared to not using any Try/catch at all. Quote Visit...Bassic Software
*Gurus* divil Posted December 5, 2002 *Gurus* Posted December 5, 2002 Not really. Structured exception handling is built in to the framework, there really isn't an alternative if you want to trap errors. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
wyrd Posted December 5, 2002 Author Posted December 5, 2002 I think the performance hit is only when you actually throw an error. I wouldn't see why catching one would cause any slow down.. Unless of course you're comparing On Error GoTo to Try.. Catch, in which case that'd be interesting to see benchmarks on. Quote Gamer extraordinaire. Programmer wannabe.
Moderators Robby Posted December 5, 2002 Moderators Posted December 5, 2002 For sure when you Throw, you are taxing your system. I ment for the occasions when all goes well and there are no exceptions, it's just because I use it a great deal, that's all. Quote Visit...Bassic Software
Moderators Robby Posted December 5, 2002 Moderators Posted December 5, 2002 Oh, and On Error has left my vocabulary. and On Error Resume Next I almost never used in VB6. btw wyrd, for the short amount of time you've been in VB6/.NET, I find that you're quite advanced. Good job. Quote Visit...Bassic Software
wyrd Posted December 6, 2002 Author Posted December 6, 2002 btw wyrd, for the short amount of time you've been in VB6/.NET, I find that you're quite advanced. Good job. Thanks. :D Heck, since you brought it up.. how long have all of you been working with .NET for? Only about a month for me. Quote Gamer extraordinaire. Programmer wannabe.
*Gurus* Derek Stone Posted December 6, 2002 *Gurus* Posted December 6, 2002 it's just because I use it a great deal Try to keep them to a minimum. Most errors can be caught in code, and don't really need exception handling at all. I've been known to go error handling crazy myself, so I know where you're coming from. Quote Posting Guidelines
*Gurus* divil Posted December 6, 2002 *Gurus* Posted December 6, 2002 Heck, since you brought it up.. how long have all of you been working with .NET for? Only about a month for me. [/b] About two and a half years. I've seen jobs posted which ask for 2 years professional C# experience. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Volte Posted December 6, 2002 *Experts* Posted December 6, 2002 About a month for me too. It's surprisingly easy to pick up. Took me about 25 minutes to grasp the basic concepts. My first program scanned directories and subdirectories and made thumbnail images of any GIF images it found. :) Quote
wyrd Posted December 6, 2002 Author Posted December 6, 2002 I've seen jobs posted which ask for 2 years professional C# experience :eek: My first program scanned directories and subdirectories and made thumbnail images of any GIF images it found. Very cool. :) Quote Gamer extraordinaire. Programmer wannabe.
*Gurus* Thinker Posted December 6, 2002 *Gurus* Posted December 6, 2002 ... Option Strict: Absolutely. Turn it on, no excuses. ... While I agree with this statement, I wonder about all the examples I have seen (even in professional books) using late binding (which Option Strict will refuse to compile). Also, many examples don't even seem to be consistantly using explicit casts. Has anyone here who normally uses it found they had to turn it off to accomplish something unusual? Quote Posting Guidelines
Moderators Robby Posted December 6, 2002 Moderators Posted December 6, 2002 Has anyone here who normally uses it found they had to turn it off to accomplish something unusual? I always use Option Strict On, the one time I did not was for this; I had a dozen RadioButtons, and I wanted to get the Tag value of the clicked item, so I added all of the handles into one click event and did this.... x = sender.Tag BTW, I started .NET 7 months ago, and last week I finished a 3 month contract using it. Quote Visit...Bassic Software
wyrd Posted December 6, 2002 Author Posted December 6, 2002 Robby: Nice. :) Quote Gamer extraordinaire. Programmer wannabe.
*Gurus* divil Posted December 6, 2002 *Gurus* Posted December 6, 2002 Thinker: I've done a great deal of different projects with vb.net and never needed to turn Option Strict off. That's not to say I haven't discovered the need to yet :) Robby: DirectCast(DirectCast(sender, RadioButton).Tag, String) Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
*Experts* Volte Posted December 15, 2002 *Experts* Posted December 15, 2002 What about creating instances of classes that you create dynamically using the CodeDom? Wouldn't you have to declare an Object variable, and then use the Assembly.CreateInstance method to initialize it? Wouldn't that be considered late-binding, and therefore, not supported by Option Strict? Quote
*Gurus* divil Posted December 15, 2002 *Gurus* Posted December 15, 2002 You are correct. However, I can see no useful application for this. You could walk the methods of the class using reflection and execute them without late binding if you had to. In practice if you were compiling class libraries on the fly, you would know a type or interface they would adhere to. Remember, C# can do virtually everything VB.NET can do and it doesn't support late binding, period. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Moderators Robby Posted December 15, 2002 Moderators Posted December 15, 2002 Originally posted by divil DirectCast(DirectCast(sender, RadioButton).Tag, String) Very nice. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.