Click here to Skip to main content
15,886,067 members
Everything / Programming Languages / C#

C#

C#

Great Reads

by 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.
by Alex Pumpet
A simple program for comparing table data from two sources - SQL databases, Excel, CSV or XML-files
by Dr. WPF
.NET 3.5 SP1 is here! It's time to break out your DirectX skills. This article provides the information necessary to get started using a new DirectX interop feature in WPF called D3DImage.
by John Atten
OWIN, Katana and Middleware Pipeline in ASP.NET

Latest Articles

by Nicolas DESCARTES
How to implement authentication in Blazor and ASP.NET Core ?
by honey the codewitch
How to validate fields for things like data entry applications.
by Yevgeniy Shunevych
An introduction to Atata C#/.NET web UI test automation full-featured framework based on Selenium WebDriver
by honey the codewitch
Scraping the web is easy with Visual FA. Here's an example of how.

All Articles

Sort by Updated

C# 

7 Nov 2010 by #andy
Sample code to get you started
22 May 2010 by #realJSOP
Don't reinvent the wheel - use the one that's already on the cart.
22 Nov 2011 by #realJSOP
A useful technique that could be used for winform apps which require a login dialog
22 May 2010 by #realJSOP
No change is too small for a complete regression test.
22 May 2010 by #realJSOP
Essential programmer skill - the ability to approach a problem from more that one direction.
9 Jul 2011 by #realJSOP
Avoid exceptions when setting enumerators from unknown/untrusted sources.
23 Jun 2010 by #realJSOP
A low-impact method for getting the appropriate path on a web page.
26 Aug 2010 by #realJSOP
You probably have better things to do than writing tedious comparison methods.
22 May 2010 by #realJSOP
Programatically set grid row/column sizes (yes, even "Auto", "*", and "X*" - thanks Nish).
10 Jul 2014 by #realJSOP
Extension methods can help you avoid sticky situations.
21 May 2010 by #realJSOP
Make interfacing with your web service simpler and more maintainable
29 Aug 2011 by #realJSOP
Using a delegate could pull your butt out of the fire when you don't want to refactor code to add functionality.
6 Jun 2010 by #realJSOP
It's not as simple as just calling DirectoryInfo.GetFiles()
9 Jun 2010 by #realJSOP
The Silverlight navigation app ErrorWindow exposes the last exception thrown, but doesn't show the INNER exceptions. Here's how you can do it.
19 Jun 2010 by #realJSOP
What to do if you want to resue a style for more than one component of a particular type on a given Silverlight Page
12 Aug 2010 by #realJSOP
If you need to get the position the mouse was clicked, in relation to a specific UI Element, this might help
26 Dec 2010 by #realJSOP
Can't you just call Enum.GetNames(), and then bind to the collection returned by that method?
1 Jan 2011 by #realJSOP
We're up to .NET 4 and MS *still* hasn't given us this simple functionality.
2 Mar 2012 by #realJSOP
If at all possible, never give your code the opportunity to fail. If there's any possibility at all that you can prevent an error condition from being raised, do it. try{ if (!string.IsNullOrEmpty(FileName)) { string newPath = System.IO.Path.Combine(FilePath,...
19 Jan 2011 by #realJSOP
Determine if specified date/time properrties are equal
24 Jan 2011 by #realJSOP
How to make your app detect whether or not it's running in admin mode.
26 Jan 2011 by #realJSOP
When you need to communicate with the app that contains your ServiceHost object, use custom events
2 Feb 2011 by #realJSOP
How to determine if your .Net app is running in the Visual Studio IDE
9 Feb 2011 by #realJSOP
StringBuilder mystring = new StringBuilder("AbCd");for (int i = 0; i
19 Feb 2011 by #realJSOP
Determine the number of unique colors in an image
7 Mar 2011 by #realJSOP
Extension method that checks for a properly Xaml-ized string
4 Apr 2011 by #realJSOP
What to do when the "you're a moron" epiphany smacks you in the head just after you've convinced yourself you're pretty clever.
9 May 2011 by #realJSOP
Get access to your Silverlight MainPage object
10 May 2011 by #realJSOP
See if an integer value is a valid value for the given "flags" enumerator
23 Jun 2011 by #realJSOP
One way to guarantee uniqueness and avoid misspelling your session variable names
5 Jul 2011 by #realJSOP
I do it this way:0) Create a base page class, and store the current page's url (you can do this any number of ways, so I'll leave it to your imagination):public class MyBasepage : System.Web.UI.Page{ public string CurrentUrl { get; set; } }1) Store the page's Url to a...
7 Jul 2011 by #realJSOP
.Net 4 has the enum.HasFlag() method, which kinda obsoletes this tip. :)
23 Jul 2011 by #realJSOP
I wouldn't create a class for this. I'd make it an extension method, and then do this:public static class String Extensions{ public static string Reverse(this string value) { value = // do your reverse code here; return value; }}// Usage:string x...
26 Jul 2011 by #realJSOP
One way to effectively zero the columns any DataRow object.
14 Sep 2011 by #realJSOP
How to automatically display a Winforms menu when the mouse is hovered over an item
10 Nov 2011 by #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...
22 Nov 2011 by #realJSOP
Allow any number of forms to be used as a main form with easy transitions between forms
15 Jun 2012 by #realJSOP
One way to get around the "invalid character" error
25 Jul 2012 by #realJSOP
Evaluating epressions in an ad-hoc condition.
12 Nov 2012 by #realJSOP
Presenting a DateTime extension class that allows you to determine the actual date of the specified instance of the specified weekday within the specified month/year.
9 Nov 2012 by #realJSOP
Stuck on a really weird problem in WPF? Move your behind and write some code (behind).
18 Apr 2013 by #realJSOP
Go here for an update that utilizes the Twitter API v1.1
10 May 2013 by #realJSOP
Determine the nature of the entry assembly
12 Sep 2013 by #realJSOP
One approach to find a specific exception type inside the containing exception
6 Feb 2015 by #realJSOP
This is an alternative for "Partial DateTime Object Equality"
5 Oct 2015 by #realJSOP
Yes, you CAN document your stored procs in C# code.
13 Sep 2016 by #realJSOP
This came as a mild surprise
31 Jan 2017 by #realJSOP
A DateTime extension method to determine if a given DateTime is one of the ten US federal holidays, using C#.
1 Feb 2017 by #realJSOP
Find the date of a specified federal holiday for a given year.
1 Feb 2017 by #realJSOP
Figuring out when Easter occurs in a given year is based on the phase of the moon, the vernal equinox, and where in the world you are.
11 Aug 2017 by #realJSOP
Handy class to reduce clutter in your code
2 Oct 2017 by #realJSOP
An answer and an example for the question, "What's the best way to learn a language or platform?"
5 Jan 2018 by #realJSOP
When you have a customized DbContext constructor.
18 Nov 2017 by #realJSOP
One less pesky nuance to worry about
28 Nov 2017 by #realJSOP
ViewBag, ViewBag, three times full...
25 Jan 2019 by #realJSOP
Sharing files between multiple web apps in a single solution.
6 May 2019 by #realJSOP
This is an alternative for "No More Session Variable Misspellings"
31 Jul 2019 by #realJSOP
Make data exchange in MVVM easy on yourself
27 Feb 2021 by #realJSOP
How to close modeless windows if you don't close them before the main window closes
29 May 2010 by #realJSOP
One technique for having a column width that grows/shrinks with ListView width
14 Mar 2013 by 李建兴
If two objects are equal, they would better have the same HashCode.
9 Jun 2015 by 0xC0000054
A C# library that resolves 64-bit shortcuts from a 32-bit application
30 Jun 2015 by 1sumitanand
This tip is for newbie developers.
1 Jul 2015 by 1sumitanand
Sorting of simple ListView Elements in Ascending/Descending Order
30 Jan 2014 by @donis2014
How to configure IIS Express "applicationhost.config" for handler mappings
21 May 2013 by _Amy
Validating the client using Lightweight Directory Access Protocol (LDAP)
22 Apr 2019 by _Asif_
Access rights issue over MSMQ could lead to hours and hours of investigation
13 Jul 2010 by _Groker
Code for summing by group in a RDLC report
16 Feb 2016 by _mayowa
The new ASP.NET 5 and its MVC provides us with some interesting features that change the approach to web development.
26 Sep 2013 by _Noctis_
This tip shows the different results of using a ListBox in different panels, and the effects on scrolling.
4 Oct 2013 by _Noctis_
Showing how to use and tweak the DateTimePicker control
9 Oct 2013 by _Noctis_
Quick tip for forms/windows/views where save/insert/cancel buttons are used
2 May 2014 by _Noctis_
Use a project with a TabControl to quickly test theories, questions, problems
12 Apr 2014 by _Noctis_
How to use Sublime text editor to help with your VS development
8 May 2015 by _Noctis_
This will allow you to integrate your linqpad code easily to Visual Studio
26 Apr 2016 by _Noctis_
How to avoid some hardcoded paths with the uses of Environment.UserName
26 Jul 2014 by _Noctis_
How to Unit Test private methods using wrappers and preproccesor directives
11 Nov 2015 by _Noctis_
This will let you start logging quickly with VS2015 and NLog 4.2.
21 Feb 2013 by A Mahesh
In WCF, you can easily create custom bindings using configuration and custom implementations.
30 Oct 2011 by A. Duman
Usage of a TrackBar as a ToolStripMenuItem
7 Jan 2015 by A. Fry
MonogoDB server side projection using the C# driver
22 Jun 2012 by A. Ganzer
Using snippets to create a full and correct implementation of complex interfaces
4 Jun 2014 by A. Najafzadeh
This tip shows how to change LINQ-to-SQL connection string at runtime via programming.
8 Jan 2015 by a.alghabban
How to use WCF to stream large file size over TCP
27 Oct 2010 by A.J.Wegierski
int empId = dt.Columns[EMP_ID].Ordinal;...int empId = Convert.ToInt32(dRow[empId]);
7 Mar 2011 by A.J.Wegierski
Extending Enums with Custom Attributes
15 Sep 2011 by A.J.Wegierski
Trick to remove an event handler out of the scope of the handler
20 Sep 2010 by a_pess
To check 64Bit Operating system in VB.NET,Public Shared Function is64BitOPeratinSystem() As Boolean Return (Marshal.SizeOf(IntPtr.Zero) = 8)End Function
13 Nov 2010 by a_pess
Alternative For VB.NET Windows Forms Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean) Me.ControlEnabled(ctrl, isDisable, True) End Sub Private Sub ControlEnabled(ByVal ctrl As Control, ByVal isDisable As Boolean, ByVal allowRecurse As...
19 Feb 2011 by a_pess
I think we may check if the color is repeated or not, any how this another alternative but in VB.NetPublic Shared Function GetImageColorsCount(ByVal bitmap As Bitmap) As Integer Dim ColorList As New System.Collections.Generic.List(Of Integer) Dim clr As Integer For...
29 Jul 2011 by a_pess
I think the code will not works on designmode, any how this the same code with a little modification but in VB. NetImports System.DrawingImports System.Windows.FormsImports System.Security.PermissionsImports System.Drawing.Drawing2DPublic Class RiverNilDateTimePicker ...
26 Nov 2014 by Aaginor
Add a Cancel-Button to the BusyIndicator (WPF Toolkit)
27 May 2012 by aamir sajjad
How to implement the custom authorization and exception handling attribute in the ASP.NET Web API.
18 Jun 2013 by Aaron Amberman
Mouse tracking and mouse binding.
23 Jun 2013 by Aaron Amberman
Defer algorithms to run once within a given time span
15 Feb 2016 by Aaron Amberman
Advanced custom logical and visual tree walking methods
28 Aug 2014 by Aaron L. Hall
Here is a tip for making sure that debugging your MVC website does not cause Visual Studio to crash when using IIS7 to host the site in your development environment: Don't use more than one worker. process in your Application pool.
27 Jan 2016 by Abdelrahman El Kinani
MySQL DB, how to design it, use it within a UWP Project