Click here to Skip to main content
15,890,512 members
This competition has ended

Best C# article of November 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.
27 Jan 2016Clifford Nelson
How to use DescriptionAttribute for enumerations bound to a ComboBox.
Please Sign up or sign in to vote.
13 Nov 2011Anoop Pillai
This post is about implementing Chain Of Responsibility design pattern, and few possible extensions to the same using Managed Extensibility Framework or MEF
Please Sign up or sign in to vote.
4 Nov 2011Elvin Cheng
How to implement UI element authorization/access control in WPF using the ICommand interface and Markup Extension
Please Sign up or sign in to vote.
28 Nov 2011Akos Orban
Set Owner of a WPF Window to a Form
Please Sign up or sign in to vote.
17 Nov 2011Timur Eroglu
List and extract .NET resources
Please Sign up or sign in to vote.
26 Nov 2011Brij
This article discusses some problems with the earlier approach and discusses Identity federation
Please Sign up or sign in to vote.
24 Nov 2011Clifford Nelson
A generic WPF/Silverlight value converter.
Please Sign up or sign in to vote.
6 Nov 2011M I developer
Try catch block around "A potentially dangerous Request.Form"
Please Sign up or sign in to vote.
11 Nov 2011lewax00
Unless I'm misunderstanding something, you can just go to properties for the project, Settings tab, and click "This project does not contain a default settings file. Click here to create one.".
Please Sign up or sign in to vote.
2 Dec 2011johnlantz
This tutorial shows how to build a simple WPF application using Code First in DevForce.
Please Sign up or sign in to vote.
18 Nov 2011rhuiden
I would first like to say that I have been through the same situation, but never took the time to develop a more dynamic converter. I like your idea, but don't like the implementation. If I know what I want to happen (when the value is true then make the control hidden), I have to do some mental...
Please Sign up or sign in to vote.
20 Nov 2011Bernhard Hiller
That's far too obscure.All you need to do is store a reference to the TabPage instance which was removed from the TabPages collection of the TabControl. You may use the form where the TabControl is placed for that purpose.You could also create your own TabControl which has an extra property...
Please Sign up or sign in to vote.
23 Nov 2011Antonino Porcino
How to use T-SQL function SCOPE_IDENTITY() to retrieve inserted rows identity values with CommandBuilders and DataAdapters
Please Sign up or sign in to vote.
19 Aug 2012wullinkm
A single file login page for ASP.NET
Please Sign up or sign in to vote.
6 Nov 2011Paulo Zemek
Using a BackgroundLoader instead of Lazy to make your application more responsive.
Please Sign up or sign in to vote.
6 Nov 2011nagendrathecoder
A workaround for using more than 64 threads with ThreadPool and WaitHandle class.
Please Sign up or sign in to vote.
14 Nov 2011Bahrudin Hrnjica
Imlementation of HTML5 Widget apps in offline mode on Windows Phone 7 Mango.
Please Sign up or sign in to vote.
27 Nov 2011Dave Kerr
Use a single Data Service to expose data from many sources with the Composite Data Service Framework!
Please Sign up or sign in to vote.
2 Nov 2011impeham
I would use a mutex object - using the process name might cause errors. Try "WaitOne" on the mutex - only the first process will be able to acquire it, and in the case of a failure, just exit.
Please Sign up or sign in to vote.
3 Nov 2011George Swan
Can't this be done with a simple for loop followed by a single if statement?for(int i=0;i
Please Sign up or sign in to vote.
6 Nov 2011Ashish Kaila
How to embed binary resources within .NET assembly and avoid file dependencies
Please Sign up or sign in to vote.
7 Nov 2011Henry.Ayoola
Jon Skeet has written an article giving six singleton implementations in C#. The simplest only works in .NET 4:public sealed class Singleton{ private static readonly Lazy lazy = new Lazy(() => new Singleton()); public static Singleton Instance {...
Please Sign up or sign in to vote.
10 Nov 2011jgauffin
With this post, I’ll show how you can use the built-in features in MVC to handle errors.
Please Sign up or sign in to vote.
10 Nov 2011#realJSOP
How about this?public static class ExtendDateTime{ public int CountWeekDays(this DateTime thisdate, DateTime thatDate) { int days = Math.Abs((thisDate - thatDate).Days) + 1; return = ((days/7) * 5) + (days % 7); }}Usage would be like this:DateTime...
Please Sign up or sign in to vote.
10 Nov 2011Adrian Alexander
Collections for WPF and NHibernate
Please Sign up or sign in to vote.
17 Nov 2011ntg123
Performing multi-binding in Silverlight.
Please Sign up or sign in to vote.
19 Nov 2011User008
Drag 'n Drop asynchronous files from an external server or device
Please Sign up or sign in to vote.
29 Nov 2011Nicolas Dorier
Generate, verify, modify code files automatically during the build process of your projects.
Please Sign up or sign in to vote.
2 Nov 2011J. Andy Wilson
I really like this method, very easy to implement and understand. One minor "gotcha" about doing it this way is that it is still possible to run multiple instances under different user accounts simultaneously if the users are not administrators on the PC. If this is a scenario you need to avoid,...
Please Sign up or sign in to vote.
7 Nov 2011bbirajdar 2 alternatives  
Programatically update connectionstring using C#
Please Sign up or sign in to vote.
5 Nov 2011zenwalker1985
String to Integer conversion Internals
Please Sign up or sign in to vote.
20 Nov 2011danlobo
I got what A.J tried to say. It's about implementing IDisposable in LockBitmap.Basically, it involves changing:public class LockBitmapto: public class LockBitmap : IDisposableThe constructor:public LockBitmap(Bitmap source){ this.source = source;}to:public...
Please Sign up or sign in to vote.
23 Nov 2011PIEBALDconsult
A C# class to raise KeyPress events for use in Console Applications
Please Sign up or sign in to vote.
26 Nov 2011Mohib Sheth
Invoking People Hub in Windows Phone 7 Emulator
Please Sign up or sign in to vote.
27 Nov 2011johannesnestler
I'd like to offer a "funny" alternative by using a dummy TextBox. public static Bitmap GetPlainTextBitmap(string strText, Font font, Color colorBack, Color colorText, Size sizeTargetBitmap) { // Create a dummy TextBox TextBox txDummy = new TextBox(); ...
Please Sign up or sign in to vote.
27 Nov 2011Felice Pollano
My C# chess engine on BitBucket
Please Sign up or sign in to vote.
28 Nov 2011Member 7656529
A review of the book Microsoft Visual Studio LightSwitch Business Application Development.
Please Sign up or sign in to vote.
1 Nov 2011Daniel Lo Nigro
As far as I know, the "UpdateModel" method is designed to do this. Something like this should work, but I haven't tested it:public ActionResult Edit(Entity entity){ var entityInDbSet = _context.Set.SingleOrDefault(x => x.Id == entity.Id); UpdateModel(entityInDbSet); ...
Please Sign up or sign in to vote.
1 Nov 2011Zac Bergquist
If you're truly targeting WPF, why not eliminate the dependency on WinForms and use System.Windows.Input.Key instead?
Please Sign up or sign in to vote.
6 Nov 2011Kabwla.Phone
Tip - Never use type equality because that does not support derived classes:if (item.GetType() == typeof(Image)) //this is bad, mkay.Instead use the following which does support derived classes:if (item is Image)The Microsoft prefered pattern (when you actually need the cast object)...
Please Sign up or sign in to vote.
5 Nov 2011Artem Smirnov
Writing testable Action Methods
Please Sign up or sign in to vote.
8 Nov 2011Delashmate
Deep Look in the basics of LINQ
Please Sign up or sign in to vote.
13 Nov 2011mabo42
Just for fun, using xor-swap, avoiding StringBuilder:string input = "AXBYCZ";char[] output = input.ToCharArray();for (int lo = 0, hi = 1; hi
Please Sign up or sign in to vote.
7 Jan 2012PIEBALDconsult 1 alternative  
A binary search technique to determine which TabPage of a TabControl was clicked
Please Sign up or sign in to vote.
10 Nov 2011zenwalker1985
I have found a few interesting things which I would like to share with you all.
Please Sign up or sign in to vote.
10 Nov 2011Adel Refaat
An implementation to support paging for SharePoint List Items
Please Sign up or sign in to vote.
14 Nov 2011Gary H Guo
Discusses how to use Component-Based Object Extender to add functionality to an application.
Please Sign up or sign in to vote.
18 Nov 2011Denno.Secqtinstien
protected void Page_Load(object sender, EventArgs e){ HttpBrowserCapabilities bc = Request.Browser; Label1.Text = "IP Address=" + Request.UserHostAddress;}
Please Sign up or sign in to vote.
2 Dec 2011johnlantz
Add entities to a model quickly, relate them to each other, and bind to them in XAML
Please Sign up or sign in to vote.
22 Nov 2011member60
One way to get browser details is using JavaScript. Take a look at the following code: var StrDummy = navigator.appVersion; strVersion = StrDummy.substring(0,4); document.write("");...

Current Participants

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

Software Developer (Senior) Paddedwall Software
United States United States
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.

My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.
Australia Australia
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
Adrian loves facilitating suave user experiences via the latest and greatest GUI technologies such as Windows 8 Metro-style apps as well as WPF. More generally, he finds joy in architecting software that is easy to comprehend and maintain. He does so by applying design patterns at the top-level, and by incessantly refactoring code at lower levels. He's always interested in hearing about opportunities for full or part-time development work. He resides in Pennsylvania but can potentially travel anywhere in the country. (Writing about himself in the third-person is Adrian's new hobby.)
Student
Poland Poland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Architect
India India
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#
Software Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer GeekSoft
Lithuania Lithuania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer (Senior) MixModes Inc. | Research In Motion
Canada Canada
Ashish worked for Microsoft for a number of years in Microsoft Visual Studio (Architect edition) and Windows Live division as a developer. Before that he was a developer consultant mainly involved in distributed service development / architecture. His main interests are distributed software architecture, patterns and practices and mobile device development.

Currently Ashish serves as a Technical Lead at RIM leading next generation BlackBerry media experience and also runs his own company MixModes Inc. specializing in .NET / WPF / Silverlight technologies. You can visit MixModes at http://mixmodes.com or follow it on Twitter @MixModes

In his free time he is an avid painter, hockey player and enjoys travelling. His blog is at: http://ashishkaila.serveblog.net
Software Developer (Senior)
Bosnia and Herzegovina Bosnia and Herzegovina
Bahrudin Hrnjica holds a Ph.D. degree in Technical Science/Engineering from University in Bihać.
Besides teaching at University, he is in the software industry for more than two decades, focusing on development technologies e.g. .NET, Visual Studio, Desktop/Web/Cloud solutions.

He works on the development and application of different ML algorithms. In the development of ML-oriented solutions and modeling, he has more than 10 years of experience. His field of interest is also the development of predictive models with the ML.NET and Keras, but also actively develop two ML-based .NET open source projects: GPdotNET-genetic programming tool and ANNdotNET - deep learning tool on .NET platform. He works in multidisciplinary teams with the mission of optimizing and selecting the ML algorithms to build ML models.

He is the author of several books, and many online articles, writes a blog at http://bhrnjica.net, regularly holds lectures at local and regional conferences, User groups and Code Camp gatherings, and is also the founder of the Bihac Developer Meetup Group. Microsoft recognizes his work and awarded him with the prestigious Microsoft MVP title for the first time in 2011, which he still holds today.
Web Developer
India India
Software developer by profession, working for a service and product based organisation in India.

Career graph:
Software Programmer since 2002.
Web Developer in ASP.NET since 2004.

Interests:
I love reading the blogs and articles of technology experts. I love codeproject and stackoverflow .

I love to share knowledge and help the programmers. I appreciate if some body corrects my code or my concepts which helps me learn.
Software Developer (Senior)
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer (Senior)
India India
Brij is a 3-times Microsoft MVP in ASP.NET/IIS Category and a passionate .NET developer. More than 6 years of experience in IT field, currently serving a MNC as a Tech Lead/Architect.

He is a very passionate .NET developer and have expertise over Web technologies like ASP.NET 2.0/3.5/4.0, jQuery, JSON, Javascript, IIS and related technologies. He is also a Exchange Server (EWS) Specialist. He has great experience in design patterns and N-Tier Architecture.

He is also certified as Microsoft Certified Technologies Specialist-ASP.NET and Microsoft Certified Technologies Specialist-WCF in .NET 4.0. He has also received several awards at various forums and his various articles got listed as "Article of the day" at ASP.NET Microsoft Official Website www.asp.net.

He has done MCA from NIT Durgapur and completed his graduation from Lucknow University.

Learning new technologies and sharing knowledge excites him most. Blogging, solving problems at various forums, helping people, keeps him busy entire day.


Visit his Blog: Code Wala

Area of Expertise :
C#, ASP.NET 2.0,3.5,4.0, AJAX, JQuery, JSON, XML, XSLT, ADO.Net, WCF, Active Directory, Exchange Server 2007 (EWS), Java script, Web Services ,Win services, DotnetNuke, WSS 3.0,Sharepoint Designer, SQL Server 2000/2005/2008
Software Developer (Senior) Clifford Nelson Consulting
United States United States
Has been working as a C# developer on contract for the last several years, including 3 years at Microsoft. Previously worked with Visual Basic and Microsoft Access VBA, and have developed code for Word, Excel and Outlook. Started working with WPF in 2007 when part of the Microsoft WPF team. For the last eight years has been working primarily as a senior WPF/C# and Silverlight/C# developer. Currently working as WPF developer with BioNano Genomics in San Diego, CA redesigning their UI for their camera system. he can be reached at qck1@hotmail.com.
Web Developer Facebook
United States United States
I'm a web developer specialising in ASP.NET MVC, PHP and JavaScript. I've got several years of web development experience and am always trying new technologies.
Brazil Brazil
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer
United Kingdom United Kingdom
Follow my blog at www.dwmkerr.com and find out about my charity at www.childrenshomesnepal.org.
Software Developer GE
Israel Israel
I am Software Developer at GE company for more than 2 years,

I created LINQTutorial.net since I didn't found any other good dedicate LINQ tutorial
Technical Lead Erls Corporation
India India
I am Dinesh kumar Choudhary by Name, a software Designer and Developer by Work, a Indian Hindu by Religion, Co-Founder of DSFoundation located at http://dsfoundation.wordpress.com by profession, a Loving husband and a Caring Father by Relation.

I have a blog Website at http://dennosecqtinstien.wordpress.com. DSFoundation is the Autonomous body to serve for the management of Local shops located at New Delhi, India. Now a days DSFoundation and its subsidiaries are managed by Erls Corporation, an Another initiative by me and my colleagues, in which i am the another CO-Founder of the Organization. Erls Corporation can be located at http:erlsindia.co.in
Singapore Singapore
Elvin Cheng is currently living in Woodlands, Singapore. He has been developing applications with the .NET Framework, using C# and ASP.NET since October 2002. Elvin specializes in building Real-time monitoring and tracking information system for Semi-conductor manufacturing industry. During his spare time, he enjoys reading books, watching movie and gym.
Italy Italy
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
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.
Student
Wales Wales
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.
Software Developer
Israel Israel
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.
Founder 1TCompany AB
Sweden Sweden
Austria Austria
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.
Software Developer (Senior)
Netherlands Netherlands
Doing that 'computer thing' ever since the C64.

Sometimes I feel that being a programmer is much like being a doctor: You just have to know everything and if you don't, something dies.

Either being an application or a patient.

Oddly enough, more people care about the death of their application, than the massacre of people...
Student
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 Writer
United States United States
<Profile>
<Profession>
I am a Software Engineer from Karachi Pakistan, Being a programmer obviously I love to code but I love to code that adds something new in my knowledge else I do copy paste usually Smile | :)
</Profession>
<Education>
Have done Master and Bachelors of Computer Science from Karachi University Pakistan
</Education>
<Interests>
Anything I found interesting technically or non-technically so nothing specific Wink | ;)
</Interests>
</Profile>
Germany Germany
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.
Software Developer
Other Other
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer (Senior) Hyperbees Technologies Pvt. Ltd.
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer Freelance
France France
I am currently the CTO of Metaco, we are leveraging the Bitcoin Blockchain for delivering financial services.

I also developed a tool to make IaaS on Azure more easy to use IaaS Management Studio.

If you want to contact me, go this way Smile | :)
Software Developer (Senior) self employed
Israel Israel
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).
Software Developer (Senior)
United States United States
BSCS 1992 Wentworth Institute of Technology

Originally from the Boston (MA) area. Lived in SoCal for a while. Now in the Phoenix (AZ) area.

OpenVMS enthusiast, ISO 8601 evangelist, photographer, opinionated SOB, acknowledged pedant and contrarian

---------------

"I would be looking for better tekkies, too. Yours are broken." -- Paul Pedant

"Using fewer technologies is better than using more." -- Rico Mariani

"Good code is its own best documentation. As you’re about to add a comment, ask yourself, ‘How can I improve the code so that this comment isn’t needed?’" -- Steve McConnell

"Every time you write a comment, you should grimace and feel the failure of your ability of expression." -- Unknown

"If you need help knowing what to think, let me know and I'll tell you." -- Jeffrey Snover [MSFT]

"Typing is no substitute for thinking." -- R.W. Hamming

"I find it appalling that you can become a programmer with less training than it takes to become a plumber." -- Bjarne Stroustrup

ZagNut’s Law: Arrogance is inversely proportional to ability.

"Well blow me sideways with a plastic marionette. I've just learned something new - and if I could award you a 100 for that post I would. Way to go you keyboard lovegod you." -- Pete O'Hanlon

"linq'ish" sounds like "inept" in German -- Andreas Gieriet

"Things would be different if I ran the zoo." -- Dr. Seuss

"Wrong is evil, and it must be defeated." –- Jeff Ello

"A good designer must rely on experience, on precise, logical thinking, and on pedantic exactness." -- Nigel Shaw

“It’s always easier to do it the hard way.” -- Blackhart

“If Unix wasn’t so bad that you can’t give it away, Bill Gates would never have succeeded in selling Windows.” -- Blackhart

"Use vertical and horizontal whitespace generously. Generally, all binary operators except '.' and '->' should be separated from their operands by blanks."

"Omit needless local variables." -- Strunk... had he taught 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.
Software Developer (Senior) www.crssoft.com
Turkey Turkey
I am a computer engineer, a .Net developer. I live in İstanbul. I work at CrsSoft, a software company.
Team Leader
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
Software Developer Dexchange Outsourcing
Netherlands Netherlands
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.
Software Developer (Senior) Siemens
India India
A .net developer since 4+ years, wild, curious and adventurous nerd.

Loves Trekking/Hiking, animals and nature.

A FOSS/Linux maniac by default Wink | ;)

An MVP aspirant and loves blogging -> https://adventurouszen.wordpress.com/
You must sign in to participate in this contest.
This contest has ended.
1 Nov - 30 Nov 2011