Click here to Skip to main content
15,903,033 members

Articles by supercat9 (Tip/Tricks: 5)

Tip/Tricks: 5

RSS Feed

Average article rating:

No articles have been posted.

Average blogs rating:

No blogs have been submitted.

Average tips rating: 4.50

.NET
29 Aug 2011   Updated: 29 Aug 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 8,500     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
It would be very nice if one could ask the .NET compilers to automatically add GC.KeepAlive(this) to the end of a class' methods; IMHO, that should have been a default behavior for classes that override Finalize. Unfortunately, since that isn't possible, one should probably, as a matter of...
Programming Languages
C#
10 Jun 2011   Updated: 10 Jun 2011   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: CPOL    Views: 8,492     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
If the right-hand operand of an assignment is a "new", there's no need to explicitly specify the type of the new variable being created unless the new variable will have to hold items of a more general type than the right-hand operand would indicate. I would consider the code clearer without the...
30 Sep 2011   Updated: 2 Oct 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 6,441     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Mutable structures and classes behave differently when it comes to Generics. Although such differences cause some people to deride mutable structs as evil, they simply offer different semantics from class types. Such semantics are for many purposes superior to those of class types, but some code...
6 May 2010   Updated: 6 May 2010   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: CPOL    Views: 6,663     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Using the Substring operation repeatedly as you do is apt to be very slow. Better would be to pass the starting indices and lengths of the two strings as parameters. That would require a manual loop to replace the String.Trim function, but it would avoid the need to create lots of new string...
C# 4.0
5 Jun 2011   Updated: 5 Jun 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 5,641     Bookmarked: 1   Downloaded: 0
Please Sign up or sign in to vote.
There are times when "try"-related wrappers can be useful. For example, a Try() wrapper DLL written in a language other than C# could pass an Exception parameter to the Finally clause indicating whether the Try clause succeeded. For example:Try (() => {DoSomething();}, (Exception inner_ex)...
22 Mar 2011   Updated: 22 Mar 2011   Rating: 0.00/5    Votes: 0   Popularity: 0.00
Licence: CPOL    Views: 5,120     Bookmarked: 0   Downloaded: 0
Please Sign up or sign in to vote.
Another approach is to use a generic delegate-factory class. Essentially, the class has a field of generic type, a delegate field which accepts an argument of that type, an parameterless instance method which accepts an argument of that type and invokes the delegate with it, and a static method...

Average reference rating:

No reference articles have been posted.

Average project rating:

No projects have been posted.
Web Developer
Unknown
Embedded systems programmer since 1994.