lamp

Browse by Tags

Sorry, but there are no more tags available to filter with.
Partial Methods to the rescue
13 July 09 10:25 PM | Frederick.Chapleau | with no comments
If you already know partial classes, you should take a look at partial method. This is far from basic c# code, but can be useful in some cases. -f. ref.: http://community.bartdesmet.net/blogs/bart/archive/2007/07/28/c-3-0-partial-methods-what-why-and...
Filed under:
IEnumerable and the yield statement
17 June 09 02:08 PM | Frederick.Chapleau | with no comments
Check out the yield statement when implementing the IEnumarable interface. You can interestingly return each values, and continue the to process... like a multiple “return” -f. ref: http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx
Filed under:
using or not using
16 June 09 05:58 PM | Frederick.Chapleau | with no comments
From MSDN: “As a rule, when you use an IDisposable object, you should declare and instantiate it in a using statement.” Simple. -f. ref: http://msdn.microsoft.com/en-us/library/yh598w02.aspx
Filed under:
Why use “this.” when calling local variables?
15 June 09 06:50 PM | Frederick.Chapleau | with no comments
Is use this. when calling local properties, so that the code is self describing. this. explicitly explain that you are accessing a class local property by the property accessor, and _variable when accessing the variable itself. -f.
Filed under:
File Split, even for handlers
12 June 09 11:57 AM | Frederick.Chapleau | with no comments
In my opinion, everything should be a file, when it’s defined on the namespace. But why? Simple: maintenance. You want a class? an enum? a eventargs or an handler? check out the file corresponding to the name of it. -f.
Filed under:
Automatic Properties, when you *think* you don’t need them
31 May 09 12:30 AM | Frederick.Chapleau | with no comments
I always create property assessors for objects. But why? Maybe just in case I need them later. Now, with VS 2008 there is a new feature, automatic properties. Check them out, it will save you time. -f. ref: http://weblogs.asp.net/scottgu/archive/2007...
Filed under:
Isolate Code by Namespace inclusion
19 May 09 08:57 PM | Frederick.Chapleau | with no comments
When it’s time to isolate code into component, a good way to do it easily is to remove namespaces from classes and references from assembly… Removing Windows.Form remove the entire Windows Form layer from the class, and separate the component. Removing...
Filed under:
Override .ToString()
12 May 09 09:15 PM | Frederick.Chapleau | with no comments
Overriding ToString() is always a good idea... but why? When it’s time to debug, you can, on all entities get a good string representation of your object without having to imagine something... also, is it a good idea is to have a constructor that requires...
Filed under:
Use of Property Accessor
26 April 09 02:02 PM | Frederick.Chapleau | with no comments
(Almost) everybody is using them, but did you even think why? There is many reasons why using them. The main one, is to control who, when and how caller are accessing the value. You can also validate data before setting it, or expose data, loaded on demand...
Filed under: