10 Tips to Improve your LINQ to SQL Application Performance

by UnquaLe 8. May 2008 08:00

I have found very helpful article that you would like also about performance of Linq to SQL. These optimizations will bring us to ADO.NET SqlDataReader performance.

There you are the article. 

Tags: ,

Linq to Regex - Regex goes easier

by UnquaLe 8. May 2008 07:45

I won't talk about how regex is useful. You know regex patterns are ugly and hard to understand then I saw Josh Flanagan's Readable Fluent Regex Api, there is another thing to like LINQ rigth now.

Very nice example to see how the api is cool. 

Download source and binaries.

Enjoy!

Tags: ,

C# Generic Type Conversion

by UnquaLe 25. October 2007 02:45

I thought C# Generics are useful also for type convertion. I messed code alittle and the emergent code snippet looks fine for me. It is easy and simple. 

public class GenericConverter
{
    public static T Parse<T>(string sourceValue) where T : IConvertible
    {
      return (T)Convert.ChangeType(sourceValue, typeof(T));
    }

    public static T Parse<T>(string sourceValue, IFormatProvider provider) where T : IConvertible
    {
      return (T)Convert.ChangeType(sourceValue, typeof(T), provider);
    }
}

//Usage
DateTime datetime = GenericConverter.Parse<DateTime>("12.10.2007");


IFormatProvider providerEN = new System.Globalization.CultureInfo("en-US", true);
IFormatProvider providerTR = new System.Globalization.CultureInfo("tr-TR", true);

DateTime x = GenericConverter.Parse<DateTime>("12.10.2007", providerTR); // ddMMyyyy
DateTime y = GenericConverter.Parse<DateTime>("12.10.2007", providerEN); // MMddyyyy

int iValue = GenericConverter.Parse<int>("12");


Enjoy !.

Doga. 

Tags: