Category Archives: .NET 4.0

Thursdays links

Countdown to Ext JS 4: Drawing and Charting

Build a Data-Driven Enterprise Web Site in 5 Minutes

Understanding the Dynamic Keyword in C# 4

New stuff in ASP.NET world!

Last week Scott Gu posted about several new things coming up onto the ASP.NET scene. They are:

IIS Developer Express: A lightweight web-server that is simple to setup, free, works with all versions of Windows, and is compatible with the full IIS 7.5.

SQL Server Compact Edition: A lightweight file-based database that is simple to setup, free, can be embedded within your ASP.NET applications, supports low-cost hosting environments, and enables databases to be optionally migrated to SQL Server.

ASP.NET “Razor”: A new view-engine option for ASP.NET that enables a code-focused templating syntax optimized around HTML generation. You can use “Razor” to easily embed VB or C# within HTML. It’s syntax is easy to write, simple to learn, and works with any text editor.

WebMatrix: A new lightweight web development tool that also integrates the above technologies, and makes it even easier for people to get started with web development using ASP.NET. This tool is free, provides core coding and database support, integrates with an open source web application gallery, and includes support to easily publish/deploy sites and applications to web hosting providers.

.Net Framework 4.0 new features

vs2010 logo .Net Framework 4.0 new features.Net Framework 4.0 adds also some new and cool features to file system objects. File class has now ReadLines() methods that returns IEnumerable. WriteAllLines() methods has two overload methods that accept IEnumerable instead of strings array that was also supported in previous versions of .Net Framework. This posting introduces ReadLines() and WriteAllLines() methods and gives you some ideas how to use these methods in your applications.

Also the new .Net Framework 4.0 Beta 2 has new IsNullOrWhiteSpace() method for strings generalizes IsNullOrEmpty() method to incluse also other white space besides empty string. In this posting I will show you simple example that illustrates how to use IsNullOrWhiteSpace() method.

.Net Framework 4.0 Beta 2 introduces new class in System.Numerics namespace: Complex. Complex represents complex numbers and enables different arithmetic operations with complex numbers. In this posting I will show you how to use complex numbers in .Net Framework 4.0 applications.

Complex class has two constructors – one of them has no arguments and the other takes real and complex parts of complex number. Complex numbers have also properties for phase and magnitude. Let’s see the following code.

Here is a more complete list:
* Complex Number
* Location
* IObservable
* Stream.CopyTo
* Guid.TryParse, Version.TryParse, and Enum.TryParse
* Enum.HasFlag
* String.Concat and String.Join overloads that take IEnumerable
* String.IsNullOrWhiteSpace
* Environment.SpecialFolder additions
* Environment.Is64BitProcess and Environment.Is64BitOperatingSystem
* Path.Combine params support
* TimeSpan Globalized Formatting and Parsing
* Stopwatch.Restart
* StringBuilder.Clear
* IntPtr and UIntPtr Addition and Subtraction operators
* ServiceProcessInstaller.DelayedAutoStart
* ObservableCollection moved to System.dll

To read more, follow the links here and here.

To read about “Data Binding in ASP.NET AJAX 4.0” click here.

Visual Studio 2010 Beta 2 and .NET Framework 4 Beta 2

vs2010 logo Visual Studio 2010 Beta 2 and .NET Framework 4 Beta 2Today from Microsoft released the links to download the new Visual Studio 2010 Beta 2 and .NET Framework 4 Beta 2!

Here is the link.

VS 2010 Product Line SKU Simplifications

With VS 2010 we are simplifying the product lineup and pricing options of Visual Studio, as well as adding new benefits for MSDN subscribers. With VS 2010 we will now ship a simpler set of SKU options:

* Visual Studio Express: Free Express SKUs for Web, VB, C#, and C++

* Visual Studio 2010 Professional with MSDN: Professional development tools as you are used to today with the addition of source control integration, bug tracking, build automation, and more. It also includes 50 hours/month of Azure cloud computing.

* Visual Studio 2010 Premium with MSDN: Premium has everything in Professional plus advanced development tools (including richer profiling and debugging, code coverage, code analysis and testing prioritization), advanced database support, UI testing, and more. Rather than buying multiple “Team” SKUs like you would with VS 2008, you can now get this combination of features in one box with VS 2010. It also includes 100 hours/month of Azure cloud computing.

* Visual Studio 2010 Ultimate with MSDN: Ultimate has everything in Premium plus additional advanced features for developers, testers, and architects including features like Intellitrace (formerly Historical Debugging), the new architecture tools (UML, discovery), test lab management, etc. It also includes 250 hours/month of Azure cloud computing.

Side by Side Support with VS 2008

VS 2010 and .NET 4.0 can be installed side-by-side on the same machine as VS 2008 and .NET 3.5. You can install the Beta 2 version on a machine and it will not impact your existing VS 2008 / .NET 3.5 development.

Go-Live License Available

.NET 4 and VS 2010 Beta 2 include a “go-live” license which means you can start using the products for production projects.

URL Routing with Visual Studio 2010 and ASP.NET 4

Some of the new features also include making SEO-friendly url’s. Before we used to write some keywords mapping but now it all could be done with code.
Before:

http://ajaxus.net/news.php?newsID=23232

Now:

http://ajaxus.net/news/Url_routing

This can be achieved with the function MapPageRoute.

Handling PostBack Scenarios

URL Routing with ASP.NET 4.0 fully supports postback scenarios. The

control will automatically emit the same URL that caused the page to be rendered. For example, if you access a page with a /products/software URL then any server-side
control within it would render out a
HTML element back to the client – which means that any postback scenarios that happen on the page will preserve the original URL.

Here is ScottGu’s blog post.

Free download Visual Web Developer book!

51x uri9j8l bo2204203200 pisitb sticker arrow clicktopright35 76 aa240 sh20 ou01  Free download Visual Web Developer book! Here are four free chapters from the book “The Microsoft Expression Web Developer’s Guide to ASP.NET 3.5: Learn to create ASP.NET applications using Visual Web Developer 2008“. You can download it from here or buy it from here.

The list of the free chapters:
* Creating Web sites
* Creating and Managing CSS Styles
* Applying CSS to Web Forms
* Debugging ASP.NET Applications

ASP.NET 4.0 and Visual Studio 2010 Web Development Beta 2 Overview

logo ASP.NET 4.0 and Visual Studio 2010 Web Development Beta 2 OverviewMany exciting changes for ASP.NET are coming in the .NET Framework version 4. This document gives an overview of many of the new features that are included in the upcoming Beta 2 release of the .NET Framework 4 and of Visual Studio 2010.
Download it from here!

VB and C# enhancements in VS 2010

dd183105visualstudio 45en usmsdn10 VB and C# enhancements in VS 2010I have found this post at somasegar’s blog writing about the new enhancements in VB and C# languages.

About VB.NET they include:
– removed the underscore (“_”) character when breaking a code statement across multiple lines
– simple way of declaring properties
– collection initializers and array literals are simpler as well
– better support for lambdas
– interoperating with dynamic language code such as Python and Ruby are simpler

Read also about C# improvements and find nice code samples here.

Couple of interesting links

  • Brad Abrams writes about “What is .NET RIA Services“. Here is a small bit of this article:

    Microsoft .NET RIA Services simplifies the traditional n-tier application pattern by bringing together the ASP.NET and Silverlight platforms. The RIA Services provides a pattern to write application logic that runs on the mid-tier and controls access to data for queries, changes and custom operations. It also provides end-to-end support for common tasks such as data validation, authentication and roles by integrating with Silverlight components on the client and ASP.NET on the mid-tier.
  • C# 4.0 goes dynamic – a step too far? Here is a small bit of this article:

    With C# 3.0 still so new that many are only just beginning to appreciate, let alone use, its new features it might seem premature to be discussing the next version of the most popular .NET language. Microsoft, however, has its plans for C# 4.0 well advanced, and the changes are so important that you might not recognise your favourite language after the upgrade. Now is the time to look over the horizon in the hope that end users can influence the outcome.

    The first thing to say is that C# occupies a very special niche in the panoply of .NET languages. When it was introduced there were essentially two classes of Windows programmers corresponding to mastery and use of either VB or C++. The split was fairly clear-cut as VB was easy to learn and easy to use but limited, and C++ was difficult to fathom but could do anything. You can even think of C++ as an object-oriented machine-independent assembly language if you want to, but VB, being interpreted and well removed from machine constructs, was no such thing. In addition there was also the aesthetic distinction to take into account – VB being messy and pragmatic and C++ pure and logical. Of course none of these characterisations is 100% true, they are just approximations to an average truth that is at least recognised by most programmers even if they’d argue over the fine details.

The Future of .NET Languages?

I came across this article and really enjoyed it, thats why I have to share it with you. Written by Damon Armstrong this article gives a bit of light what is next in .NET field.

Co-Evolution for VB.NET and C#

One of the most prominent messages coming from Microsoft right now is geared towards Microsoft Visual Basic® .NET developers. VB.NET and Microsoft Visual C#® are both built on top of the Common Language Runtime (CLR), which means they both compile down into the same Common Intermediate Language (CIL). Since they both compile down to the same code, there should be no intrinsic benefit of one language over another. However, both languages are maintained by separate teams at Microsoft, and over the years this separation has led to a variety of language-specific features in both C# and VB.NET as the teams focus on different areas with their respective products. Many VB.NET developers feel that the most exciting new features appear in C# first and are only later introduced into VB.NET. Naturally, this has generated a bit of animosity in the VB.NET community.

Introducing the Dynamic Language Runtime

Microsoft is acutely aware that the .NET Framework is not the only choice for building applications. All you have to do is take a quick glance around the development sphere and you’ll find a number of language options, and that number is only expected to rise as domain-specific languages emerge. People are spending time and energy writing useful components in these languages, so the question is, how can you use a component written in another language without having to rewrite it in .NET?

At a high level, you can think of the Dynamic Language Runtime as having three layers (see figure 1 below):

* .NET Language Integration
* DLR Core Components
* Language Binders

image001 The Future of .NET Languages?

The first layer, .NET Language Integration, simply represents the need for .NET languages to have a notion of what the DLR is and how to use it. For the most part, you won’t even notice this aspect of the DLR because most of the .NET languages had a natural integration point. IronRuby and IronPython are both dynamically typed languages, so the DLR fit right in. VB.NET has always supported the notion of late binding on the Object type, so the DLR incorporated nicely into late binding resolution. C#, however, has no notion of late binding and needed an additional static type for dynamic language support. It’s called the dynamic type, and we’ll talk about it in more detail a bit later.

Language Binders, which make up the third layer, are language-specific implementations of certain operations the Dynamic Language Runtime needs to understand about each language that wishes to participate in the DLR.

New Language Features in .NET 4.0
– Dynamic Lookup (New to C#)
– Named and Optional Parameters (New to C#)
– Anonymous Method Support (New to VB.NET)
– Co-variance and Contra-variance (New to C# and VB.NET)
– Dynamic Import (New to C#)
– Omitting Ref Parameters (New to C#)
– Compiling without Primary Interop Assemblies (New to C# and VB.NET)
– Implicit Line Continuation (New to VB.NET)
– Simplified Property Syntax (New to VB.NET)
– Array Type Inference and Jagged Arrays (New to VB.NET)
– From Keyword (New to VB.NET)

Functional Programming with F#

F# is a succinct, high performance, type-inferred, functional language built on top of the .NET Framework. Microsoft has a solid base of imperative programming languages with VB.NET and C#, but there is a trend in computing that tends to be moving towards a more declarative style of programming. What’s the difference? In an imperative language you write code that tells the compiler exactly how to do something, whereas in a declarative language you write code that says what you want to do, but leave the “how” part up to the compiler. Now, the ultimate declarative language would allow you to write something like “Morph the screen into something cool” and then compile your thoughts into a wicked screen saver or some such, but we’re not there just yet. F# offers developers the opportunity to explore declarative concepts and offer a useful language to customers whose thinking is geared more towards functional development.

Read the whole of this article from the source.