Thursday, September 23, 2010

How to parse large XML files efficiently using LINQ

Sometimes we want to parse a very large xml file and populate our custom objects and we need to do it efficiently, because the file is so large, we dont want to load the whole file in memory, using XmlReader looks good but needs a lot of coding and we have to take care of every details when parsing.

Tuesday, September 21, 2010

How to measure the time the method takes to run in C#

.Net framework provides StopWatch class in (System.Diagnostics.StopWatch). we can use this class to measure the time for a method takes to finish executing.

Friday, September 17, 2010

How to pass DateTime object from .Net to Flex using json

I have a wcf rest service in .net that needs to serialize an object to json that has a DateTime property and send it back to my flex application.

Friday, September 10, 2010

How to get the generated sql query sending to server by entity framework

This is a sample linq query in EF,
for example, we have 2 tables:
Contents, Tags (one to many, each content has zero or more tags)

Saturday, September 4, 2010

Consuming .Net WCF Rest in different ways

There are different ways to consume wcf rest services in .net, The basic idea is first creating the http request and include the message body and message header. we need to serialize the objects we are going to send, then we need to send the request and then get the response and deserialize to get the response objects.