Monday, September 22, 2014
The case-insensitive regular expression for Canada postal code
^[abceghjklmnprstvxyABCEGHJKLMNPRSTVXY]\d[a-zA-Z]\d[a-zA-Z]\d$
Friday, September 19, 2014
How to display Textbox input to upper case in ASP.NET MVC razor view?
1. Create css class
.uppercase
{
text-transform: uppercase;
}
2. Add this class into Textbox in razor view
@Html.TextBoxFor(model => model.PostCode, new { @class = "uppercase" })
Note: the value still keeps original value.
.uppercase
{
text-transform: uppercase;
}
2. Add this class into Textbox in razor view
@Html.TextBoxFor(model => model.PostCode, new { @class = "uppercase" })
Note: the value still keeps original value.
Thursday, September 18, 2014
How to write Singleton pattern in C#?
http://msdn.microsoft.com/en-us/library/ff650316.aspx
using System;
public sealed class Singleton
{
private static volatile Singleton instance;
private static object syncRoot = new Object();
private Singleton() {}
public static Singleton Instance
{
get
{
if (instance == null)
{
lock (syncRoot)
{
if (instance == null)
instance = new Singleton();
}
}
return instance;
}
}
}
Subscribe to:
Posts (Atom)