January 2010
3 posts
.NET Tip : How to print all property names &...
Heres .net code public static void PrintClassMemberValues(object source, System.IO.TextWriter tw) { Type sourceType = source.GetType(); tw.WriteLine(“——————- ” + sourceType.Name + ” ——————- “); foreach (PropertyInfo sourceProperty in sourceType.GetProperties()) { tw.WriteLine(sourceProperty.Name...
Jan 29th
Enable GZIP Compression in ASP.NET Pages
GZIP Compression in ASP.NET Pages public static bool IsGZipSupported(HttpContext Context) { string AcceptEncoding = Context.Request.Headers[“Accept-Encoding”]; if (string.IsNullOrEmpty(AcceptEncoding) == false &&         (AcceptEncoding.Contains(“gzip”) || AcceptEncoding.Contains(“deflate”))) { return true; } else { return false; } } ...
Jan 29th
.NET Tip : How to copy all property values from...
Do you ever wanted to copy ALL Property Values from one .net Class to another (Whilst Both of them having properties with similar names)? Heres Method for that : public static void CopyPropertyValues(object source, object destination) { Type sourceType = source.GetType(); Type destinationType = destination.GetType(); foreach (PropertyInfo sourceProperty in sourceType.GetProperties()) ...
Jan 29th