Click here to Skip to main content
15,884,836 members
This competition has ended

Best C# article of September 2011

Contribute to CodeProject and you'll automatically be in the running for a monthly prize!

Each month at CodeProject we gather together the best of the articles submitted the previous month and ask our readers to choose the best of the best. Entry is automatic - just submit you articke and we'll do the rest.

Check out the submission guidelines for information on posting articles.

Current Entries

Articles that match the contest criteria are automatically entered. The top 50 entries are shown.

Please Sign up or sign in to vote.
11 Sep 2011Anshul Mehra
This article provide APIs & functionality so that Excel Quits after automation
Please Sign up or sign in to vote.
15 Sep 2011Reiss 1 alternative  
A guide on how to call overload constructors in C#
Please Sign up or sign in to vote.
26 Sep 2011MBigglesworth79
A good primer for getting into serialization
Please Sign up or sign in to vote.
18 Sep 2011Monjurul Habib
How to add namespaces for Razor pages
Please Sign up or sign in to vote.
3 Sep 2011Sofa Team
Step by Step conversion of an application into a Docking application component
Please Sign up or sign in to vote.
31 Mar 2017Dan Colasanti
AutoResetEvent can be used in place of AsyncWaitHandle and provides a thread-blocking WaitOne signaled timeout function, which can be put on a background thread in order to not block the main UI thread.
Please Sign up or sign in to vote.
12 Sep 2011girijaa
A covariant type parameter can be used as the return type of a generic delegate/interface, and contravariant type parameters can be used as input parameter types.
Please Sign up or sign in to vote.
11 Sep 2011brunofer2007
Easy way to sort nodes in a TreeView using a recursive function.
Please Sign up or sign in to vote.
15 Sep 2011Nathan Stiles
A class written to easily handle long paths (32K in length) using .NET.
Please Sign up or sign in to vote.
6 Sep 2011EmitsorGrp
Automatically generate a Windows Phone 7 settings page.
Please Sign up or sign in to vote.
7 Sep 2011Eric Xue (brokensnow)
How to resolve SharePoint document locked for editing issue
Please Sign up or sign in to vote.
12 Sep 2011Bill Anderson
Here's an alternative. This one uses the BitArray class in C# and does not use the % operator.static List SeiveWithoutMod(int candidate){ BitArray sieveContainer = new BitArray(candidate + 1, true); int marker = 2; //start int factor = 2; //start. sieveContainer[0]...
Please Sign up or sign in to vote.
22 Sep 2011smoore4
Loop through all files in a folder/subfolders and run a checksum that is stored in a database. E-mail descrepancies and results.
Please Sign up or sign in to vote.
20 Sep 2011Raymund Macaalay
Simple TSQL and C# entity generator for S#arp architecture
Please Sign up or sign in to vote.
18 Sep 2011ninasalimi
View States in .NET
Please Sign up or sign in to vote.
23 Sep 2011Ercan Anlama
Introduces how to integrate and use the validation block features in Microsoft Enterprise Library 5.0 with WCF.
Please Sign up or sign in to vote.
30 Sep 2011Bill Anderson
Hi,Thanks for the feedback for alternative #1 from above (and thank you, Jurgen Rohr for your suggestion! I replaced the "reset" line with:while (!sieveContainer.Get(++marker));factor = marker;Here is another algorithm that's slightly different. It's not as elegant an approach, but...
Please Sign up or sign in to vote.
30 Sep 2011BobJanova 1 alternative  
How to wrap a value type so it can be used in positions where a reference type is required
Please Sign up or sign in to vote.
16 Sep 2011Kunal Chowdhury «IN»
Pinging a network IP or Hostname is not available in Silverlight. But you can do this using WCF service. In this post, I am going to implement the same thing for you.
Please Sign up or sign in to vote.
3 Oct 2011Adam Covitch
It is common to configure back-end database tables to contain a column with an auto-generated ID unique to each row. This tip describes how to sync the ID generated by the database back to the application layer.
Please Sign up or sign in to vote.
15 Sep 2011NeoModulus
For when you want CRUD quick and don't care how you get it.
Please Sign up or sign in to vote.
13 Sep 2011Gary H Guo
Add AOP capabilities to Windsor Container by configuration using Dynamic Decorator
Please Sign up or sign in to vote.
15 Sep 2011ChunkyStool
The alternative posted by Daaron does not work for several cases. E.g. Sign is included (+ or -), text contains whitespace prefix or suffix, etc. You could fix the first two limitations with a more detailed regex like "(^\s*(-|\+)?\d+\s*$)" but you could still end up with a value that won't fit...
Please Sign up or sign in to vote.
13 Sep 2011Pete O'Hanlon
How I coded the Scrubber command that’s available in the new version.
Please Sign up or sign in to vote.
15 Sep 2011kribo
System.Windows.Forms.ColorDialog in a small WPF project TextEditor.
Please Sign up or sign in to vote.
2 Oct 2011Mohammad A Rahman
The List class already has a method doing the same job as:public static void ForEach(this IList list, Action function)More about the ForEach method is available here. Here is the reflected ForEach method:public void ForEach(Action action){ if (action == null) { ...
Please Sign up or sign in to vote.
21 Sep 2011Anshul R
Private Sub GetIPAddress()Dim strHostName As StringDim strIPAddress As StringstrHostName = System.Net.Dns.GetHostName()strIPAddress = System.Net.Dns.Resolve(strHostName).AddressList(0).ToString()MessageBox.Show("Host Name: " & strHostName & "; IP Address: " &...
Please Sign up or sign in to vote.
18 Dec 2011SwarnenduDas
How to fetch an image document from FileNet for a known Document ID
Please Sign up or sign in to vote.
28 Sep 2011Ram Balak Sharma 1 alternative  
Useful when calling a C# method from JavaScript by using JSON which returns a DataTable.
Please Sign up or sign in to vote.
2 Sep 2011jgauffin
A set of best practices helping you to get the most out of your container
Please Sign up or sign in to vote.
6 Sep 2011User 271009
Simplifying Prism WPF Navigation – Synchronous Navigation Confirmation
Please Sign up or sign in to vote.
6 Sep 2011Steve L. Powell
The need for speed: Excel Buffer Class
Please Sign up or sign in to vote.
13 Sep 2011jgauffin
How to get clean and flexible model + validation localization in ASP.NET MVC3
Please Sign up or sign in to vote.
15 Sep 2011A.J.Wegierski
Trick to remove an event handler out of the scope of the handler
Please Sign up or sign in to vote.
16 Sep 2011kribo
WPF dynamic TabControl - TabItems
Please Sign up or sign in to vote.
19 Sep 2011Gary H Guo
Discuss how to add AOP capabilities to IoC containers using a configurable model of Dynamic Decorator
Please Sign up or sign in to vote.
22 Sep 2011nlarson11
On Vista/Win 7, I have seen code where only a single period is returned for (0). This makes sure you get the actual IP regardless of the system.Const IPPattern As String = "^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$"With Dns.GetHostEntry(System.Environment.MachineName) Return...
Please Sign up or sign in to vote.
23 Sep 2011Anshul R
See this for implementing Singletonhttp://msdn.microsoft.com/en-us/library/ff650316.aspx[^]
Please Sign up or sign in to vote.
2 Oct 2011Mohammad A Rahman
In addition, there are many articles posts that have been discussed about this, for example,Single Instance Application in C#[^]Single-Instance C# Application - for .NET 2.0[^]Stream Decorator, Single-Instance Apps[^]
Please Sign up or sign in to vote.
28 Sep 2011Muhammad Shahid Farooq
No need to write piece of code in Visual Studio 2008 and greater for single instance of your program or application. Go to the project properties and checked the check box "Make single instance application".
Please Sign up or sign in to vote.
30 Sep 2011Mohammad A Rahman
Following might be another way to do the job:public static string ConvertDataTableToString(this DataTable dt){ StringBuilder stringBuilder = new StringBuilder(); dt.Rows.Cast().ToList().ForEach(dataRow => { ...
7 Sep 2011Steve Hawley
This guide will take you through setting up a basic web page containing an embedded Web Document Viewer and displaying an initial document in it.
7 Sep 2011Accusoft
Enterprises use cloud services to save money on storage, desktop software and facilitate collaboration with coworkers. Provide applications the ability to capture images locally from a scanner and upload to the Cloud in just a few lines of code.
Please Sign up or sign in to vote.
3 Sep 2011K.Kirivarnan
Register New Account using Matrix XMPP Library
Please Sign up or sign in to vote.
2 Oct 2011Paulo Zemek
I think the start is wrong... we can pass types as parameters.A method like this:void ShowName(Type type){ Console.WriteLine(type.FullName);}can be called as:ShowName(typeof(object));or as this:ShowName(someObject.GetType());If you are trying to say that we can't...
Please Sign up or sign in to vote.
2 Oct 2011Reiss
Whilst this is a good tip, I wouldn't go as far as qualifing an entire class as you have done. I would stop at the namespace level, so your example becomes:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Drawing;using Media =...
Please Sign up or sign in to vote.
3 Oct 2011wmjordan
Some people remarked that the Visual-Studio-generated build number actually contains a hidden timestamp, which, I think, is far from being intuitive. I wrote the following snippet to do something similar but is easier to understand.Beside changing the version number, we can even write build...
Please Sign up or sign in to vote.
9 Sep 2011Simon Monk
Standards in Mobile Development
Please Sign up or sign in to vote.
12 Sep 2011Gary H Guo
Add AOP capabilities to Unity Container by configuration using Dynamic Decorator.

Current Participants

Those with articles that match the contest criteria are automatically entered.

Technical Lead
India India

Kunal Chowdhury is a former Microsoft "Windows Platform Development" MVP (Most Valuable Professional, 2010 - 2018), a Codeproject Mentor, Speaker in various Microsoft events, Author, passionate Blogger and a Senior Technical Lead by profession.

He is currently working in an MNC located in India. He has a very good skill over XAML, C#, Silverlight, Windows Phone, WPF and Windows app development. He posts his findings, articles, tutorials in his technical blog (www.kunal-chowdhury.com) and CodeProject.


Books authored:


Connect with Kunal on:




Web Developer
Poland Poland
Complicated
United States United States
Accusoft provides a full spectrum of document, content, and imaging solutions as fully supported, enterprise-grade, client-server applications, mobile apps, cloud services, and software development kits. The company is focused on solving document lifecycle complexities through:


- A customer-focused approach
- Continuous product development
- Proactive support
- Forward-thinking leadership

Founded in 1991, Accusoft has grown through persistent product innovation and strategic mergers and acquisitions into the best-in-class solutions provider it is today. The company has been awarded 30 patents and is recognized as a thought leader in the industry.
This is a Organisation

1 members
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Architect
United States United States
I am not only a technology consumer, but a technology contributor also. I keep my self engaged with at-least 2 dev projects (in personal capacity) at any time. My strength is at providing robust and better solution. I can write full scale (product grade) softwares, tools & libraries. I am an avid knowledge seeker and always keep my self updated with the latest framework stacks on Python, .Net, Java and C++ technologies.
Student
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Web Developer
United States United States
Developer
United Kingdom United Kingdom
I'm a recent graduate (MSci) from the University of Cambridge, no longer studying Geology. Programming is a hobby so I get to write all the cool things and not all the boring things Smile | :) . However I now have a job in which I have to do a bit of work with a computer too.
Software Developer (Senior) Martifer Inovação e Gestão
Portugal Portugal
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer Insight Global
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
President ImproviSoft LLC
United States United States
Dan is the Founder and President of ImproviSoft LLC (mobile software) and AdStreamer, Inc. (mobile advertising) - both Microsoft BizSpark Plus Startups.

Dan holds a B.S. in Computer Science from Clarkson University and M.S. degrees in Computer Science and Computer Engineering from Syracuse University. He is an ASQ Certified Software Quality Engineer (CSQE) and was a 2012 Microsoft XNA/DirectX MVP.

Prior experience includes Software Engineering, Project Management, and Functional Management in the Aerospace & Defense, Medical Devices, Automotive Engineering, and e-Commerce industries.

Dan's dev-blog is The ImproviSoft Blog.
Software Developer (Senior) Emitsor Group
Mexico Mexico
Focused on creating MS Windows 8, Silverlight, Windows Phone 7 & 8 and the Web applications.

More than 20 years of experience creating software solutions.
Software Developer
Turkey Turkey
I am interested in innovation and creativity in software development and passionate in learning new stuff.
Architect F-Tech Software
Australia Australia
Eric has more than 10 years’ experience within the IT industry, specialising in designing and implementing solutions using Microsoft technology stack.

He’s currently working with SharePoint 2010/2013, Tableau, OBIEE, QlikView, SAP BusinessObjects Enterprise XI 3.1/XI 4.0, SAP BusinessObjects Dashboards 4.0 (Xcelsius Enterprise 2011), FAST Search 2010 for SharePoint, Dynamics CRM2011/4.0, .NET 3.5/4.0/4.5, Asp.net Ajax, SQL Server 2008R2/2012/2014, SSIS, SSAS, SSRS and DQS.

With a passion for learning cutting-edge technologies and constantly updating his existing skills set, Eric’s project experience covers all area of software consulting including pre-sales, analysis, design and implementation.

You could catch me via linked-in http://au.linkedin.com/in/ericxuesydney or my blog
United States United States
Object-oriented (OO) is about "classes" not "objects". But I truly believe that "objects" deserve more our attentions. If you agree, read more on... Dynamic Object Programming (DOP), Component-Based Object Extender (CBO Extender), AOP Container and Dynamic Decorator Pattern.

Mobile development is not just another type of front end. The real challenge is actually in the back end: How to present meaningful information in time to mobile users with exponentially increased data flooding around? Here is my first mobile solution: SmartBars - Barcode Reader, Price Comparison and Coupons.

Gary lives in southeast Michigan. My first programming language is FORTRAN. For the last a few years, I have primarily focused on .NET technologies with Mobile Development as my newest interest.
Technical Lead Mastek
India India
A Software professional with expertise in developing applications using Microsoft Stack [.Net 2.0/3.0/3.5/4.0] , SQL Server 2005/2008 , Asp.Net [Webforms,MVC] , Entity Framework , WPF , Winforms , Enterprise Library .
Knowledge of Sharepoint [MOSS 2007] and SQL Server BI and still learning ...
Founder 1TCompany AB
Sweden Sweden
Software Developer (Senior)
Singapore Singapore
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Web Developer
Belgium Belgium
Developer within C#, Dynamics NAV (Navision), Php environments.
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer
Australia Australia
Software Developer (Senior)
Singapore Singapore
A life-long-learner, maker and soft music fan. Likes building things to solve problems. Years of successful records serving mid and large scale .NET applications in domestic and international client environment. Expertise in different areas of software development life cycles and Software Architecture.

Always looks for new technology and loves to get hands dirty Smile | :)
Software Developer (Senior) ForeVision Business Solutions
Pakistan Pakistan
Software Engineer | System Integrator | Architect

Muhammad Shahid Farooq is a software engineer with having experience of 9+ years of working on ADO.Net, C#.Net, VB.Net, VB6/VBA, SQL Server, Oracle, MySQL and other latest technologies. He holds Bachelor’s degree in Computer Science from the University of Central Punjab, Lahore, Pakistan. To contact Shahid, email him at muhammadshahidfarooq@yahoo.com.
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer NeoModulus Consulting, LLC
United States United States
This member doesn't quite have enough reputation to be able to display their biography and homepage.
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Architect GBIS
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer (Senior) Microsoft
United States United States
I started to program computers when I was 11 years old, as a hobbyist, programming in AMOS Basic and Blitz Basic for Amiga.
At 12 I had my first try with assembler, but it was too difficult at the time. Then, in the same year, I learned C and, after learning C, I was finally able to learn assembler (for Motorola 680x0).
Not sure, but probably between 12 and 13, I started to learn C++. I always programmed "in an object oriented way", but using function pointers instead of virtual methods.

At 15 I started to learn Pascal at school and to use Delphi. At 16 I started my first internship (using Delphi). At 18 I started to work professionally using C++ and since then I've developed my programming skills as a professional developer in C++ and C#, generally creating libraries that help other developers do their work easier, faster and with less errors.

Want more info or simply want to contact me?
Take a look at: http://paulozemek.azurewebsites.net/
Or e-mail me at: paulozemek@outlook.com

Codeproject MVP 2012, 2015 & 2016
Microsoft MVP 2013-2014 (in October 2014 I started working at Microsoft, so I can't be a Microsoft MVP anymore).
CEO
United Kingdom United Kingdom
A developer for over 30 years, I've been lucky enough to write articles and applications for Code Project as well as the Intel Ultimate Coder - Going Perceptual challenge. I live in the North East of England with 2 wonderful daughters and a wonderful wife.

I am not the Stig, but I do wish I had Lotus Tuned Suspension.
Architect Q3 technology
India India
Ram is .Net Architect by profession and passion having 8 year experience. He has extensive experience on Microsoft Development Platform and is also Microsoft Certified Application Developer (MCAD) for Web.
Reach me at rsharma@stackdotnet.com

http://www.stackdotnet.com/
6 Freely avaliable E-Books/
Technical Lead
New Zealand New Zealand
http://nz.linkedin.com/in/macaalay
http://macaalay.com/
Program Manager
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Database Developer
United States United States
I am an MBA with a bunch of MS certifications. Technically, I am a DBA, but I do a good deal of sys admin work and web development using .NET. I like to focus on business intelligence, database design, messaging architectures, and web services.
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Architect Atalasoft, a Kofax Company
United States United States
Steve Hawley is a software engineer/architect at Atalasoft, Inc., responsible for current and future component designs.
Software Developer Excel Adviser
Canada Canada
I am a freelance software developer with a variety of different interests. My main area of expertise is Microsoft Office add-ins (Excel/Outlook mostly) but I also develop Windows applications, Access Databases and Excel macros . I develop in VBA, C# and C++. My website exceladviser.com has articles on Excel, Access, Microsoft Office development, and general Windows programming (WPF, etc.).
Software Developer Standout IT Solutions(P) Ltd.
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Technical Lead
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Technical Lead
China China
I am now programming applications for the Internet of Things.
You must sign in to participate in this contest.
This contest has ended.
1 Sep - 30 Sep 2011