.NET news » Examples Examples Rss Feed

TComparer - Sort a List

Sort a strongly typed list of custom objects by their specific property
22 Nov 2010, 22:59:00   Source: TComparer - Sort a List   Tags: Examples C#

Formatting Dates, Times and Numbers in ASP.NET

Formatting is the process of converting a variable from its native type into a string representation. Anytime you display a DateTime or numeric variables in an ASP.NET page, you are formatting that variable from its native type into some sort of string representation. How a DateTime or numeric variable is formatted depends on the culture settings and the format string. Because dates and numeric values are formatted differently across cultures, the .NET Framework bases its formatting on the specified culture settings. By default, the formatting routines use the culture settings defined on the web server, but you can indicate that a particular culture be used anytime you format. In addition to the culture settings, formatting is also affected by a format string, which spells out the formatting details to apply.

The .NET Framework contains a bounty of format strings. There are standard format strings, which are typically a single letter that applies detailed formatting logic. For example, the "C" format specifier will format a numeric type as a currency value; the "Y" format specifier displays the month name and four-digit year of the specified DateTime value. There are also custom format strings, which display a apply a very specific formatting rule. These custom format strings can be put together to build more intricate formats. For instance, the format string "dddd, MMMM d" displays the full day of the week name followed by a comma followed by the full name of the month followed by the day of the month. For more involved formatting scenarios, where neither the standard or custom format strings cut the mustard, you can always create your own formatting extension methods.

This article explores the standard format strings for dates, times and numbers and includes a number of custom formatting methods I've created and use in my own projects. There's also a demo application you can download that lets you specify a culture and then shows you the output for the standard format strings for the selected culture.

9 Nov 2010, 18:00:00   Source: Formatting Dates, Times and Numbers in ASP.NET   Tags: Examples

WCF by Example - Chapter X - Dependency Injection with Spring.Net

How to use Spring.Net DI reducing coupling and enhancing automated testing
2 Nov 2010, 17:28:00   Source: WCF by Example - Chapter X - Dependency Injection with...   Tags: Examples

Using WPF MVVM for Database Access

An example of a WPF MVVM utility accessing a simple legacy database.
2 Nov 2010, 15:49:00   Source: Using WPF MVVM for Database Access   Tags: Examples

Cloud Collaboration: Connecting SharePoint to Windows Azure with Silverlight Web Parts

There are many ways to integrate Windows Azure applications with SharePoint 2010. We’ll walk you through one example: a Silverlight-based Web Part that consumes data from the cloud.
1 Nov 2010, 19:00:00   Source: Cloud Collaboration: Connecting SharePoint to Windows...   Tags: Examples

Beginners Guide to Visual Studio LightSwitch

In this article, I will show you how you can start with Visual Studio LightSwitch with an example.
30 Oct 2010, 01:31:00   Source: Beginners Guide to Visual Studio LightSwitch   Tags: Examples

Monitoring a MySQL Server Process

An example of monitoring a Windows process
26 Oct 2010, 18:19:00   Source: Monitoring a MySQL Server Process   Tags: Examples

Simple TextBox Derived Custom Control: Filter Key Input

This is an example of a Custom Control that inherits from a TextBox and does a simple enhancement to the TextBox
22 Oct 2010, 13:47:00   Source: Simple TextBox Derived Custom Control: Filter Key Input   Tags: Examples

Wake the PC from standby or hibernation

How to wake up the PC at a certain time.
4 Oct 2010, 14:32:00   Source: Wake the PC from standby or hibernation   Tags: Examples

WCF by Example - Chapter VII - WPF Client - Contract Locator

Baseline WCF Distribution Layer - Decoupling of WCF Services and ViewModels