Click here to Skip to main content
14,266,113 members

Best C# article of June 2011

This competition has ended

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.

16 Jun 2011
Wonde Tadesse
The other option will be to use Update Panel ASP.NET control as much as possible. It helps to retain the current position on the page whenever a postback happens to the page.
4 Jun 2011
MBigglesworth79
An introduction to Reflection in .NET as well as some examples of how it can be used.
13 Jun 2011
Ctznkane
The Array class already contains this capability with no casting required. The IndexOf method is a static one that returns the index of the value and a -1 if it doesn't exist.Here is an example:exists = Array.IndexOf(arr, "item") >= 0
21 Jun 2011
Kiran Sonawane
1 alternative  
A trick when using Array.Contains()
15 Jun 2011
PSK_
1 alternative  
How to maintain scroll position of a long page with vertical scrollbar in browser other than IE.
13 Jun 2011
Luc Pattyn
This is an alternative to "L33t Tr4nsl4t0r (Leet Translator)".
27 Jun 2011
charles henington
1 alternative  
5 Jun 2011
JV9999
Not really, because what if your finally block would contain more lines of code than the single line you have in your example? That would make it already much harder to read.Secondly, you are misusing the Dispose method. You shouldn't invoke anything in it, especially not the Action, you...
7 Jun 2011
Kim Togo
2 alternatives  
Code to change text to Leet
9 Jun 2011
Kanwal Shehzad
How to avoid WPF TreeView SelectedItemChanged being called twice
14 Jun 2011
Tamir Khason
How to import OpenSSL private key into .NET application and use it with X509 public certificate to establish TLS connection with asymmetric encryption and two phase certificates handshake
17 Jun 2011
VallarasuS
1 alternative  
Here is how you can achieve Gradients used in Office 2010 Buttons with a glow at the bottom.
27 Jun 2011
Mukit, Ataul
This tip shows you how to create a delegate from a C++ function pointer
28 Jun 2011
Joel Ivory Johnson
Peer Communication on Windows Phone 7
2 Jun 2011
AlexCode
Using ResolveUrl without Page
8 Jun 2011
Kunal Chowdhury «IN»
Silverlight 5 Features Local File System Access without using COM API
10 Jun 2011
supercat9
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...
12 Jun 2011
Mohammad A Rahman
Caching uses with Proxy pattern in C#
12 Jun 2011
PeteBarber
It is critically important to make sure that a View's DataContext is properly created and attached before the underlying Window is displayed, otherwise initial events will be missed.
15 Jun 2011
George Swan
As it stands, the TryParse method will fail if the string contains commas. E.g., 10,000. To get around this, you can use:bool isnumber=int.TryParse(text,System.Globalization.NumberStyles.Integer | System.Globalization.NumberStyles.AllowThousands, ...
15 Jun 2011
charles henington
1 alternative  
22 Jun 2011
Andrew Rissing
A simple trick to remove the delay of Thread.Sleep for unit testing.
29 Jun 2011
Erich Ledesma
I rather like IEnumerable than IList, parameters should be as general as posible. I think it's really getting very fun up here. Here's my choice, just for strings.public static string Join(this IEnumerable parts, string separator){ if (! parts.Any()) return...
2 Jun 2011
IGood
I'm a fan of these guys... (Though I feel like I might catch some flack for the first one.)public static bool IsNullOrEmpty(this ICollection collection){ return collection == null || collection.Count == 0;}public static float Clamp(this float value, float low, float hi){...
9 Jun 2011
FDW
This is what I would do:using System;using NUnit.Framework;using System.Reflection;namespace Profix.Utils.Xpo.UnitTests{ [TestFixture] public class Functions { private void Tax() { Console.WriteLine("Computed Tax."); } private void Sale() {...
10 Jun 2011
Arik Poznanski
“After the Deadline” provides a web based API for both grammar and spell checking, free for non-commercial use!
12 Jun 2011
GAMerritt
A C# method which rounds to the nearest multiple of a chosen power of an arbitrary base.
14 Jun 2011
YDaoust
What aboutpublic static string NUMthOF(UInt32 v){ return v.ToString() + // Append the ordinal suffix for the unit digit // unless the ten digit is a one (force 'th') "thstndrdthththththth".Substring(2 * (int)(v / 10 % 10 != 1 ? v % 10 : 0), 2);}?Now all...
14 Jun 2011
MWBate
I have been using the following code (suggested by someone on an MSDN forum) to determine if a default mail client has been configured:RegistryKey hkey = Registry.ClassesRoot.OpenSubKey( "mailto\\shell\\open\\command", false);hkey will be null if there is no such client.
15 Jun 2011
leopard447
How to do distinct raw data population in a DataTable
16 Jun 2011
Artem Smirnov
For those of you scared by the numerous steps required to setup a typical Open Source project, this would be a pleasant surprise.
16 Jun 2011
Artem Smirnov
A few tricks in using FubuMVC
21 Jun 2011
SergeyT2
You can use Action instead of MethodInvoker as well. And ".Invoke" at the method is unnesessary.public static void ThreadSafeCall(this Control control, Action method){ if (control.InvokeRequired) { control.Invoke(method); } else { method(); ...
24 Jun 2011
ddthien
How to read choice values for Multi choice questions in a Survey
26 Jun 2011
JP_Rocks
4 alternatives  
A tip to concatenate a set of strings using comma/pipe
29 Jun 2011
Mohammad A Rahman
The code has been updated to improve the performance:public static bool DoSequenceOfOr(params Func[] sequenceOfBooleanValue){ foreach (Func item in sequenceOfBooleanValue) if (item()) return true; return false;}public static bool...
29 Jun 2011
Philippe Mori
Instead of doing it yourself, a better way would be to use LINQ for that purpose. Here is an example for addition:int[] numbers = { 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };int result = numbers.Aggregate((x, y) => x + y).ToString());and for multiplication:long[] numbers = { 4, 5, 6, 7,...
8 Jun 2011
Kim Togo
I have tried to change the code with a good idea from Luc Pattyn (Thanks).The code is more compact, and I have tried to make the code more simple, that handles the degree selection.// Leet Translator - L33t Tr4nsl4t0r.// Version 2.//// Just for the fun.//using...
29 Jun 2011
Ziad J.khan
You can find a much more advanced version of this here:http://univar.codeplex.com[^]The version provided on the download page is soon to be deprecated by the upcoming version 2.0b however. The latter is available here instead:http://univar.codeplex.com/SourceControl/list/changesets[^]
23 Sep 2013
Mehdi Khalili
This article is an introduction to installing and using bddify - a simple to use and extend BDD framework for .NET developers.
3 Jul 2018
Ciumac Sergiu
Explains sound fingerprinting algorithm, with a practical example of detecting duplicate files on the user's local drive.
4 Jun 2011
Gil Fink
A running example of how to configure a self reference entity with Code First
16 Aug 2011
Wayne Ye
HTML5 WebSocket defines a bi-directional, full-duplex communication channel operates through a single TCP connection, this article discusses its fantastic performance, the WebSocket protocol principle and its handshake mechanism, and develop a WebSocket application in action (Team Poker).
14 Jun 2011
ITFunda
In this article, we are going to learn how to avoid the Session fixation vulnerability in ASP.NET.
24 Feb 2014
Shivprasad koirala
In this article we will try to understand what regex is and how to remember those cryptic syntaxes easily.
21 Feb 2014
Sacha Barber
WPF: Version II of my 100% Reflective class diagram creation tool.
12 Jun 2011
D. Christian Ohle
C# use Zip archives without external libraries
14 Jun 2011
Matt Perdeck
Describes a fast algorithm to pack a series of rectangles of varying widths and heights into an enclosing rectangle of minimum size
16 Jun 2011
Colin Eberhardt
A simple metro-in-motion behaviour which reduces the Panorama control’s contents while the user slides from item-to-item so that they can really appreciate your fancy background graphic!

Current Participants

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

Kunal Chowdhury «IN»
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:




PSK_
Architect
India India
Its me Smile | :)
AlexCode
Architect
Switzerland Switzerland
Senior IT Consultant working in Switzerland as Senior Software Engineer.

Find more at on my blog.
Andrew Rissing
Software Developer (Senior)
United States United States
Since I've begun my profession as a software developer, I've learned one important fact - change is inevitable. Requirements change, code changes, and life changes.

So..If you're not moving forward, you're moving backwards.
Arik Poznanski
Software Developer (Senior) Verint
Israel Israel
Arik Poznanski is a senior software developer at Verint. He completed two B.Sc. degrees in Mathematics & Computer Science, summa cum laude, from the Technion in Israel.

Arik has extensive knowledge and experience in many Microsoft technologies, including .NET with C#, WPF, Silverlight, WinForms, Interop, COM/ATL programming, C++ Win32 programming and reverse engineering (assembly, IL).
Artem Smirnov
Software Developer GeekSoft
Lithuania Lithuania
No Biography provided
charles henington
United States United States
I do not claim to be wrong! I just rarely ever write.
Ciumac Sergiu
Software Developer
Moldova (Republic of) Moldova (Republic of)
Interested in computer science, math, research, and everything that relates to innovation. Fan of agnostic programming, don't mind developing under any platform/framework if it explores interesting topics. In search of a better programming paradigm.
Colin Eberhardt
Architect Scott Logic
United Kingdom United Kingdom
I am CTO at ShinobiControls, a team of iOS developers who are carefully crafting iOS charts, grids and controls for making your applications awesome.

I am a Technical Architect for Visiblox which have developed the world's fastest WPF / Silverlight and WP7 charts.

I am also a Technical Evangelist at Scott Logic, a provider of bespoke financial software and consultancy for the retail and investment banking, stockbroking, asset management and hedge fund communities.

Visit my blog - Colin Eberhardt's Adventures in .NET.

Follow me on Twitter - @ColinEberhardt

-
Ctznkane
United States United States
No Biography provided
No Biography provided
ddthien
United States United States
No Biography provided
Erich Ledesma
Architect SunHotels
Spain Spain
I Received a Bachelor's Degree in Computer Science at the Mathematics and Computer Science Faculty, University of Havana, Cuba.

I mainly work in web applications using C# and some Javascript. Some very few times do some Java.
FDW
Netherlands Netherlands
No Biography provided
GAMerritt
United States United States
Writer, designer, inventor, musician, observer, and critic with many years of experience in each of these areas. I can do without the approval of "experts" because I believe candid statements and penetrating analysis bring greater rewards than a "pat on the back". And if I have something to say when you're not listening, I tell someone else about it.
George Swan
Student
Wales Wales
No Biography provided
Gil Fink
Technical Lead sparXys
Israel Israel
Gil Fink is a web development expert and ASP.Net/IIS Microsoft MVP. He is the founder and owner of sparXys. He is currently consulting for various enterprises and companies, where he helps to develop Web and RIA-based solutions. He conducts lectures and workshops for individuals and enterprises who want to specialize in infrastructure and web development. He is also co-author of several Microsoft Official Courses (MOCs) and training kits, co-author of "Pro Single Page Application Development" book (Apress) and the founder of Front-End.IL Meetup. You can read his publications at his website: http://www.gilfink.net
IGood
Software Developer 5TH Cell
United States United States
Tools & gameplay programmer at 5TH Cell Media.
DigiPen student class of '09.
ITFunda
IT Funda Corporation
India India
Provide online .NET training and training materials.
Joel Ivory Johnson
Software Developer
United States United States
I attended Southern Polytechnic State University and earned a Bachelors of Science in Computer Science and later returned to earn a Masters of Science in Software Engineering. I've largely developed solutions that are based on a mix of Microsoft technologies with open source technologies mixed in. I've got an interest in astronomy and you'll see that interest overflow into some of my code project articles from time to time.



Twitter:@j2inet

Instagram: j2inet

JP_Rocks
India India
No Biography provided
JV9999
Software Developer (Senior)
Netherlands Netherlands
No Biography provided
Kanwal Shehzad
Software Developer (Senior) Al Kaffary
Saudi Arabia Saudi Arabia
I am Computer Science graduate and working in Microsoft technologies (VB.Net/C#, ASP.Net, WPF, WCF, SQL Server 2005/2008, Web Services).
Kim Togo
Software Developer Miralix
Denmark Denmark
Has worked as a programmer since 1999, starting with C++/MFC, Java, PHP and MySQL. Now it is all about C# (my favorite programming language), MS SQL, Azure and Xamarin (iOS/Android/WP8)

My primary work is to create applications that interacts with PABC/PBX, Microsoft Lync / UCMA.
Kiran Sonawane
Team Leader iNautix Technologies
India India
I am microsoft professional having about 8 years of experience on web technologies and working as TechLead. I am self starter guy and proficient in asp.net, web & wcf service. Try to learn something new everyday, this is how I work. In my 8 years of experience I worked with Microsoft technology, PHP, classic ASP, Cold Fusion and Ruby on Rails
leopard447
Pakistan Pakistan
No Biography provided
Luc Pattyn
Software Developer (Senior)
Belgium Belgium
I am an engineer with a background in electronics, software and mathematics.

I develop technical software, both for embedded systems and for desktop equipment. This includes operating systems, communication software, local networks, image processing, machine control, automation, etc.

I have been using all kinds of microcontrollers and microprocessors (Intel 4004/8080/8051/80386/Pentium, Motorola 680x/680x0/ColdFire/PowerPC, Microchip PIC, Altera NIOS, and many more), lots of programming languages (all relevant assemblers, Fortran, Basic, C, Java, C#, and many more), and different operating systems (both proprietary and commercial).

For desktop applications and general development tools I have been using both UNIX systems and Mac/MacOS for many years, but I have switched to x86-based PCs with Windows, Visual Studio and the .NET Framework several years ago.

I specialize in:
- cross-platform development (making software that runs on diverse hardware/OS combinations)
- instruction set simulation
- improving software performance, i.e. making sure the software runs the job at hand in as short a time as possible on the given hardware. This entails algorithm selection, implementation design, accurate measurements, code optimisation, and sometimes implementing virtual machines, applying SIMD technology (such as MMX/SSE), and more.
Matt Perdeck
Architect
Australia Australia
Twitter: @MattPerdeck
LinkedIn: au.linkedin.com/in/mattperdeck
Current project: JSNLog JavaScript Logging Package

Matt has over 9 years .NET and SQL Server development experience. Before getting into .Net, he worked on a number of systems, ranging from the largest ATM network in The Netherlands to embedded software in advanced Wide Area Networks and the largest ticketing web site in Australia. He has lived and worked in Australia, The Netherlands, Slovakia and Thailand.

He is the author of the book ASP.NET Performance Secrets (www.amazon.com/ASP-NET-Site-Performance-Secrets-Perdeck/dp/1849690685) in which he shows in clear and practical terms how to quickly find the biggest bottlenecks holding back the performance of your web site, and how to then remove those bottlenecks. The book deals with all environments affecting a web site - the web server, the database server and the browser.

Matt currently lives in Sydney, Australia. He recently worked at Readify and the global professional services company PwC. He now works at SP Health, a global provider of weight loss web sites such at CSIRO's TotalWellBeingDiet.com and BiggestLoserClub.com.
MBigglesworth79
Web Developer
United Kingdom United Kingdom
No Biography provided
Mehdi Khalili
Chief Technology Officer Genie solutions
Australia Australia
No Biography provided
Mukit, Ataul
Technical Lead Kotha Technologies
Bangladesh Bangladesh
If you are not in - you are out !
- Chapter 1
MWBate
Architect
Unknown
No Biography provided
PeteBarber
Team Leader
United Kingdom United Kingdom
My day job is mostly working in C++ with a bit of C#. I write a fair amount of command line based tools and really wish they could have a GUI front-end to them hence why I spend my spare time working with WPF.

I started a blog few years back but didn't do a lot with it. I've started describing some of the interesting programming things I come across on it. Please take a look.
Philippe Mori
Software Developer (Senior)
Canada Canada
Programmer at Maid LABS from 2003 (www.maidlabs.com)

Programmer-Analyst at Viasat Geo Technoligies from 1995 to 2002 (www.viasat-geo.com).

I have studied at École Polytechnique de Montréal in computer engineering.
RaisKazi
Technical Lead
United States United States
Full Stack Technology Professional

Hands-on experience with -
. Asp.Net, MVC, C#, Ajax
. JavaScript, Jquery, AngularJS
. Xamarin
. SharePoint
. VBScript

Tested flavors of -
. Java, Perl, Python, NodeJS, Android, IOS(little bit)
Sacha Barber
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog
SergeyT2
Software Developer
Russian Federation Russian Federation
No Biography provided
supercat9
Web Developer
Unknown
Embedded systems programmer since 1994.
Tamir Khason
Architect Better Place
Israel Israel
Hello! My name is Tamir Khason, and I am software architect, project manager, system analyst and [of course] programmer. In addition to writing big amount of documentation, I also write code, a lot of code. I used to work as a freelance architect, project manager, trainer, and consultant here, in Israel, but recently join the company with extremely persuasive idea - to make a world better place. I have very pretty wife and 3 charming kids, but unfortunately almost no time for them.

To be updated within articles, I publishing, visit my blog or subscribe RSS feed. Also you can follow me on Twitter to be up to date about my everyday life.
VallarasuS
Technical Lead
India India
I code, learn, listen, and some day in a near future be a proud farmer.
Wayne Ye
Software Developer (Senior) SAP Labs Shanghai
China China
Wayne is a software developer, Tech Lead and also a geek. He has more than 6 years' experience in Web development(server: ASP.NET (MVC), Web Service, IIS; Client: HTML/CSS/JavaScript/jQuery/AJAX), Windows development (Winform, Windows Service, WPF/Silverlight, Win32 API and WMI) and SQL Server. Deep understanding of GOF Design Patterns, S.O.L.i.D principle, MVC, MVVM, Domain Driven Design, SOA, REST and AOP.

Wayne's Geek Life http://WayneYe.com

Infinite passion on programming!
Wonde Tadesse
Architect
United States United States
MSCS, MCTS, Senior Software Engineer, Architect, Craftsman, The Ultimate DEV ...
Azure Series

YDaoust
CEO VISION fOr VISION
Belgium Belgium
No Biography provided
Ziad J.khan
Software Developer (Senior)
Mauritius Mauritius
No Biography provided
You must sign in to participate in this contest.
This contest has ended.
1 Jun - 30 Jun 2011