C# · CodeProject · Dotnet · Tools

BoxCop – Static Assembly Analyzer tool

Dear Reader, In this article I am going to explain about a small tool which I have developed as my personal project for a couple of weekends in between my busy schedules. This small tool, which I like to call it as BoxCop is basically a static analyzer just like FxCop. I conceived this idea… Continue reading BoxCop – Static Assembly Analyzer tool

C# · CodeProject · Dotnet

Singleton in non-inheritable vs inheritable classes

Dear Reader, Today i learned some thing from my architect @work place which i would like to share with you all. In fact i was reviewing some code and there i saw a class having singleton implemented but not in a traditional way in other words we developers more often implement singleton pattern for static… Continue reading Singleton in non-inheritable vs inheritable classes

C# · CodeProject · Dotnet

Method call in Using block TIP

Dear Reader, Further to my first post here, today i noticed some thing cool with respect to Using blocks in C#. We all know that in using block, usually we create a type which implements IDisposable as shown below: public class MyClass : IDisposable    {        public void Dispose()        {            Console.WriteLine(“Disposed”);        }    } And the usage code looks like: using (MyClass m = new MyClass()) { } Infact… Continue reading Method call in Using block TIP

C# · CodeProject · Dotnet

Try not to implement Property with only set accessor TIP

Dear Reader, Again as with my code reviews one of the thing i noticed in many classes is that they all have properties with only set accessors but either no get accessor at all or with a private get accessor. Although if you think for a sec, it sounds good to have many times a… Continue reading Try not to implement Property with only set accessor TIP

C# · CodeProject · Dotnet

Reason to make your class Sealed by default

Dear Reader, Lately i have been reviewing/refactoring alot of code, and i must say many a times some code pushed me to a confused state, because they are not sealed. Now reading this you may wonder that i might sound silly. The problem is with inheritance here. When there are alot of code in your… Continue reading Reason to make your class Sealed by default

C# · CodeProject · Dotnet

String.Compare vs CultureInfo.Compare TIP

Dear Reader, Just few moments ago i learned some thing on Stackoverflow, hence i thought of sharing the same with you. For comparing strings with culture specific, we normally use String.Compare. But very rarely people would have seen other API available in .NET FCL called CultureInfo.Compare(). So i started to dig in and saw whats… Continue reading String.Compare vs CultureInfo.Compare TIP

C# · CodeProject · Dotnet

Better Approach to Clearing StringBuilder TIP

Dear Reader, Lately i am refactoring many code and one such code i found out was that to append strings in a loop where its iteration count is pretty much unknown. Infact i have seen many code else where too where in many developers use stringbuilder to append strings before even knowing if it’s really… Continue reading Better Approach to Clearing StringBuilder TIP