About the author

Vijay Kodali
E-mail me Send mail

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2024

Lambda Expressions

A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.Lambda Expressions provide a more concise, functional syntax for writing anonymous methods.

Categories: .Net 3.5 | C# | LINQ
Posted by vijay on Tuesday, January 22, 2008 8:43 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Anonymous Types

Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to first explicitly define a type.

 This is an important feature for the LINQ feature that will be integrated into C#. Since anonymous types do not have a named typing, they must be stored in variables declared using the var keyword, telling the C# compiler to use type inference for the variable.


Categories: .Net 3.5 | C#3.0
Posted by vijay on Monday, January 21, 2008 10:57 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Implicitly Typed Local Variables-“Var”

In C# 3.0, you can declare an integer  as –

[code:c#]

var first = 7;

Console.WriteLine("First variable is of type: {0}", first.GetType());

[/code]

It will return”Int32” as DateType, even though we declare it as “var”. So what  is “var”?

from MSDN..

Local variables can be given an inferred "type" of var instead of an explicit type. The var keyword instructs the compiler to infer the type of the variable from the expression on the right side of the initialization statement.

To put it simply "var" is a keyword that results in variable being of the same data type, of the initializer. It works similar to “object” type in older version. But there is great difference between “Object” and “var”. Check following code snippet-

[code:c#]

object newObj = 58;  

int test = newObj; //this line result in an error "Cannot implicitly convert type object to int"

 int test = (int)newObj; // this line will work. But result in boxing..additional overhead

[/code]

So Objects have boxing and unboxing issues. Now consider same instance with “var”- 

[code:c#]

var newObj = 22;

int test = newObj; //no boxing involved. It is type-safe

[/code]

C# is still strongly typed. “Var” is NOT a variant, everything is known by the compiler at compile-time.

Tags:
Posted by vijay on Friday, January 18, 2008 9:11 PM
Permalink | Comments (0) | Post RSSRSS comment feed

ListView

One of the new controls in ASP.NET 3.5 is ListView. It resembles the GridView control, except that it displays data by using user-defined templates instead of row fields.

The ListView control supports the following features:

ü  Support for binding to data source controls such as SqlDataSource, LinqDataSource, and ObjectDataSource.

ü  Customizable appearance through user-defined templates and styles.

ü  Built-in sorting capabilities.

ü  Built-in update and delete capabilities.

ü  Built-in insert capabilities.

ü  Support for paging capabilities by using a DataPager control.

ü  Built-in item selection capabilities.

ü  Programmatic access to the ListView object model to dynamically set properties, handle events, and so on.

ü  Multiple key fields.

 


Categories: .Net 3.5 | ASP.Net 3.5 | C#
Posted by vijay on Monday, January 14, 2008 8:13 PM
Permalink | Comments (0) | Post RSSRSS comment feed

cursor position after postback

To maintain cursor position on every page, set following code in web.config file

<system.web>             
        <pages maintainScrollPositionOnPostBack="true"></pages>
</system.web> 

Categories: ASP.NET | ASP.Net 3.5
Posted by vijay on Thursday, January 10, 2008 12:09 PM
Permalink | Comments (1) | Post RSSRSS comment feed

Some new features in Visual studio 2008

1)       Multi-Targeting Support

Earlier you were not able to working with .NET 1.1 applications directly in visual studio 2005. Now in Visual studio 2008 you are able to create, run, debug the .NET 2.0, .NET 3.0 and .NET 3.5 applications. You can also deploy .NET 2.0 applications in the machines which contains only .NET 2.0 not .NET 3.x.

2)       Vertical Split View :

This feature show both design and source code in single window.  To enable vertical split-view orientation in VS 2008, select the tools->options menu item and go to the HTML Designer->General section.  Then check the "Split views vertically"  checkbox

3)       Javascript Debugging

Visual Studio 2008 makes it is simpler with javascript debugging. You can set break points and run the javaScript step by step and you can watch the local variables when you were debugging the javascript and solution explorer provides javascript document navigation support.

4)       Web Design and CSS Support

 Microsoft has added new Web Design and CSS Support to Visual Studio 2008

5)       AJAX & Silverlight Library support for ASP.NET

Previously developer has to install AJAX control library separately that does not come from VS, but now if you install Visual Studio 2008, you can built-in AJAX control library. Also in VS 2008 Silverlight Library is inbuilt.

6)       Access to .NET Framework Source Code

you can debug the source code of .NET Framework Library methods.

 


Posted by vijay on Friday, January 4, 2008 2:54 PM
Permalink | Comments (0) | Post RSSRSS comment feed