Click Here
Sunday, March 30, 2008
Thursday, March 27, 2008
HttpWebRequest over SSL
public static bool
AcceptAllCertificatePolicy(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
return true;
}
The returned value determines whether the specified certificate is accepted for authentication.
Then set:
ServicePointManager.ServerCertificateValidationCallback
+= AcceptAllCertificatePolicy;
From here
Tuesday, March 25, 2008
Inline ASP.NET tags(<%$, <%=, <%, <%#, etc.)
Full article read here.
Tuesday, March 18, 2008
Class name generator
Can't think of a good class name? Try this: ClassNamer
Sunday, March 09, 2008
Singleton Factory in C#
// this is the class for which
// I want to maintain a single instance
public class MyClass
{
private MyClass()
{
/* private constructor ensures that
callers cannot instantiate an
object using new() */
}
}
// Singleton factory implementation
public static class Singleton<T> where T : class
{
// static constructor,
//runtime ensures thread safety
static Singleton()
{
// create the single instance
// of the type T using reflection
Instance = (T)Activator.CreateInstance(
typeof(T),true);
}
// serve the single instance to callers
public static T Instance { private set; get; }
}
class Program
{
public static void Main()
{
// test
Console.WriteLine(
Object.ReferenceEquals(
Singleton<MyClass>.Instance,
Singleton<MyClass>.Instance));
}
}
via Cognitive Coding
Thursday, March 06, 2008
Patterns and Practices: Complete Catalog
Subscribe to:
Posts (Atom)