Ratnakar’s Weblog

A sneak peek into ASP.NET MVC Preview 4 Release

Posted in .Net Framework 3.5, ASP.Net, C#, General I.T, Visual Studio 2008 by Ratnakar Garikipati on July 15, 2008

If you are keeping a close eye on what’s happening in the ASP.Net MVC space – Scott Guthrie has a post suggesting that the next Preview version (# 4) is to be expected later this week – which I can’t wait to get my hands on!!!

This is perfect for me in terms of timing because for the last few months I have been spending most of my time at one of our client’s place training/mentoring their application development team while trying to employ/adopt a long-term/future-proof Enterprise Development Strategy.

I was reluctant to introduce MVC yet to the team as it is still early stages. Although with some level of custom coding you can implement the core aspects of AJAX  etc, I wanted to wait until I check out Preview 4 – rightly so and as expected here comes an announcement from Scott that preview 4 has new features such as Caching, Error Handling and Security plus further additional support for AJAX.




C# 3.0 demo

Posted in C# by Ratnakar Garikipati on August 24, 2007

My previous blog talks about the new C# language enhancements/extensions.


Here’s an excerpt from Luke’s C# demo at TechEd 2007 which covers things like Auto-Implemented properties, ‘var’ – Local Variable Type Inference, Collection Initializers, Object Initializers, Lambda Expressions etc


If you are a C# enthusiast…I would suggest you subscribe to his feeds at: http://blogs.msdn.com/lukeh/


using System;

//using System.Linq;

using System.Collections.Generic;

class Customer


    // C#3.0 Feature:  Auto-Implemented Properties

    public string CustomerID { get; set; }

    public string ContactName { get; set; }

    public string City { get; set; }


public delegate TResult Func<TArg, TResult>(TArg c);

static class Query


    // C#3.0 Feature:  Extension Methods

    public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T,bool> filter)


        foreach (var item in source)

            if (filter(item))

                yield return item;


    public static IEnumerable<TResult> Select<TSource,TResult>(this IEnumerable<TSource> source, Func<TSource,TResult> selector)


        foreach (var item in source)

            yield return selector(item);



class Program


    static void Main(string[] args)


        List<Customer> customers = LoadCustomers();

        // C#3.0 Feature:  Query Expressions

        var query = from c in customers

                    where c.City == “London”

                    // C#3.0 Feature:  Anonymous Types

                    select new { c.CustomerID, c.ContactName };

        // C#3.0 Feature:  Lambda Expressions

        //var query = Query.Select(Query.Where(customers, c => c.City == “London”),

        //                         c => new { c.CustomerID, c.ContactName });

        //var query = customers.Where(c => c.City == “London”)

        //                     .Select(c => new { c.CustomerID, c.ContactName });

        foreach (var item in query)

            Console.WriteLine(“{0}, {1}”, item.CustomerID, item.ContactName);


    private static List<Customer> LoadCustomers()


        // C#3.0 Feature:  ‘var’ – Local Variable Type Inference

        // C#3.0 Feature:  Collection Initializers

        var customers = new List<Customer>()


            // C#3.0 Feature:  Object Initializers

            new Customer { CustomerID = “ALFKI”, ContactName = “Maria Anders”, City = “Berlin”},

            new Customer { CustomerID = “ANATR”, ContactName = “Ana Trujillo”, City = “México D.F.”},

            new Customer { CustomerID = “WOLZA”, ContactName = “Zbyszek Piestrzeniewicz”, City = “Warszawa”}


        return customers;