Click here to Skip to main content

Articles by supercat9 (Tip/Tricks: 6)

Tip/Tricks: 6

RSS Feed
No articles have been posted.
No blogs have been submitted.

Average tips rating: 4.50

C#
General
Posted: 10 Jun 2011   Updated: 10 Jun 2011   Views: 1,694   Rating: 5.00/5    Votes: 2   Popularity: 1.51
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
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...
Posted: 30 Sep 2011   Updated: 2 Oct 2011   Views: 1,961   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
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...
Programming Tips
General
Posted: 5 Jun 2011   Updated: 5 Jun 2011   Views: 2,036   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 1   Downloaded: 0
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)...
Posted: 29 Aug 2011   Updated: 29 Aug 2011   Views: 1,728   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
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...
String handling
General
Posted: 6 May 2010   Updated: 6 May 2010   Views: 2,011   Rating: 4.00/5    Votes: 1   Popularity: 0.00
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
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...
Threads, Processes & IPC
General
Posted: 22 Mar 2011   Updated: 22 Mar 2011   Views: 1,357   Rating: 0.0 / 5    Votes: 0   Popularity: 0.0
Licence: The Code Project Open License (CPOL)      Bookmarked: 0   Downloaded: 0
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...
No reference articles have been posted.

supercat9
Web Developer
Unknown
Embedded systems programmer since 1994.


Advertise | Privacy | Mobile
Web02 | 2.8.1411028.1 | Last Updated 28 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid