Monday, February 18, 2013

What is the difference between Visual Studio and Visual Studio Express?

Visual Studio Expression is a free but less featureful version of Visual Studio Pro. As you've noticed it doesn't support plugins and a number of other features. It does support the editing of MVC web applications so it should be just fine for your purposes.


Which features are missing from Visual Web Developer Express?
Here is what is not in VWD Express:
1. Extensibility. In Express edition you cannot install and use Web Application ProjectsWeb Deployment Projects,CSS Properties WindowHTML/ASP.NET Spell CheckerReSharper and any other add-on or third party tool.
2. Class Libraries. VWD Express only supports a single type of project: Web site. You cannot add a Class Library project or a Web Controls Library project to the solution. Class libraries are popular way to sharing business logic code or any other utility code.
3. Source Code Control. SCC is crucial in team development. I can't imagine my life as professional developer without good Source Code Control system that provides me with change history, branches, merges, etc.
4. Accessibility checker. If you are developing Web sites that must be accessible, Accessibility Checker is indispensible tool.
5. Automatig generation of resources for localization. If your Web must be localized in multiple languages, you do want to have this feature.
6. Attach debugger to a process. If you need to step through code in existing classic ASP pages in order to understand how it works or you have to maintain classic ASP pages, you need ASP debugging which requires ability to attach debugger to a running process.
7. Native code debugging. Some legacy code, especially in classic ASP code may be using COM objects written in C++. Mixed mode debugging is not supported in Express.
All of the above is available in the Visual Studio Standard Edition. However, Professional Edition gives you XSLT debugging, extensive database tools, it comes with SQL 2005 Developer Edition (as opposed to SQL Express in VS Standard and below) and Crystal Reports.

Friday, February 1, 2013

Pro WPF 4.5 in C#: Windows Presentation Foundation in .NET 4.5


Pro WPF 4.5 in C#: Windows Presentation Foundation in .NET 4.5

Pro WPF 4.5 in C#: Windows Presentation Foundation in .NET 4.5 
4th edition | 2013 | ISBN-10: 1430243651 | PDF, EPUB | 1112 pages | 62 MB


Microsoft's Windows Presentation Foundation (WPF) provides you with a development framework for building high-quality user experiences for the Windows operating system. It blends together rich content from a wide range of sources and allows you unparalleled access to the processing power of your Windows computer.


Pro WPF 4.5 in C# provides a thorough, authoritative guide to how WPF really works. Packed with no-nonsense examples and practical advice you'll learn everything you need to know in order to use WPF in a professional setting. The book begins by building a firm foundation of elementary concepts, using your existing C# skills as a frame of reference, before moving on to discuss advanced concepts and demonstrate them in a hands-on way that emphasizes the time and effort savings that can be gained.

What you'll learn:

Understand the fundamentals of WPF programming from XAML to controls and data flow.
Develop realistic application scenarios to see navigation, localization and deployment in action.
Explore the advanced user interface controls that WPF provides.
Learn to manage documents from within WPF: Text layout, printing, and document packaging are all covered.
Use graphics and multimedia to add punch to your applications
Who this book is for

This book is designed for developers encountering WPF for the first time in their professional lives. A working knowledge of C# and the basic architecture of .NET is helpful to follow the examples easily, but all concepts will be explained from the ground up.

Pro WPF 4.5 in VB: Windows Presentation Foundation in .NET 4.5


Pro WPF 4.5 in VB: Windows Presentation Foundation in .NET 4.5

Pro WPF 4.5 in VB: Windows Presentation Foundation in .NET 4.5 
2013 | ISBN-10: 1430246839 | PDF, EPUB | 1104 pages | 34.8 MB


Microsoft's Windows Presentation Foundation (WPF) provides you with a development framework for building high-quality user experiences for the Windows operating system. It blends together rich content from a wide range of sources and allows you unparalleled access to the processing power of your Windows computer.

Pro WPF 4.5 in VB provides a thorough, authoritative guide to how WPF really works. Packed with no-nonsense examples and practical advice you'll learn everything you need to know in order to use WPF in a professional setting. The book begins by building a firm foundation of elementary concepts, using your existing VB skills as a frame of reference, before moving on to discuss advanced concepts and demonstrate them in a hands-on way that emphasizes the time and effort savings that can be gained.

What you'll learn

Understand the fundamentals of WPF programming from XAML to controls and data flow.
Develop realistic application scenarios to see navigation, localization and deployment in action.
Explore the advanced user interface controls that WPF provides.
Learn to manage documents from within WPF: Text layout, printing, and document packaging are all covered.
Use graphics and multimedia to add punch to your applications.
Who this book is for

This book is designed for developers encountering WPF for the first time in their professional lives. A working knowledge of Visual Basic and the basic architecture of .NET is helpful to follow the examples easily, but all concepts will be explained from the ground up.

Monday, January 28, 2013

An Introduction to New Features in C# 5.0


1. C# Evolution Matrix
Microsoft just published a new version of C# : 5.0 beta with CLR version 4.5 (Visual Studio 11 beta).
In order to get a big picture of the whole evolution of C# language, I summarized all the key features
into a C# Evolution Matrix for your reference as below diagram shows:


In C# version 5.0, there are two key features: Async Programming and Caller Information.
2. Async Feature
Two new key words are used for Async feature: async modifier and await operator. Method marked
with async modifier is called async method. This new feature will help us a lot in async programming.
For example, in the programming of Winform, the UI thread will be blocked while we use
HttpWebRequest synchronously request any resource in the Internet. From the perspective of user
experience, we cannot interact with the form before the request is done.
private void
btnTest_Click(object sender, EventArgs e)

{

var request = WebRequest.Create(txtUrl.Text.Trim());

var content=new MemoryStream();

using (var response = request.GetResponse())

{

using (var responseStream = response.GetResponseStream())

{

responseStream.CopyTo(content);

}

}

txtResult.Text = content.Length.ToString();

}


In the above example, after we clicked the Test button, we cannot not make any change to the form
before the txtResult textbox shows the result.
In the past, we can also use BeginGetResponse method to send async request as this sample in MSDN
shows:
http://msdn.microsoft.com/zh-cn/library/system.net.httpwebrequest.begingetresponse(v=vs.80).aspx. But it
will takes us a lot effort to realize it.
Now, we can simply use below code to do request asynchronously :
private async void
btnTest_Click(object sender, EventArgs e)

{

var request = WebRequest.Create(txtUrl.Text.Trim());

var content = new MemoryStream();

Task<WebResponse> responseTask = request.GetResponseAsync();

using (var response = await responseTask)

{
using (var
responseStream = response.GetResponseStream())

{

Task copyTask = responseStream.CopyToAsync(content);

//await operator to supends the excution of the method until the task is completed. In the meantime,
the control is returned the UI thread.

await copyTask;

}

}

txtResult.Text = content.Length.ToString();

}
The await operator is applied to the returned task. The await operator suspends execution of the
method until the task is completed. Meanwhile, control is returned to the caller of the suspended
method.
3. Caller Information
Caller Information can help us in tracing, debugging and creating diagnose tools. It will help us
to avoid duplicate codes which are generally invoked in many methods for same purpose, such
as logging and tracing.
We could get the below information of caller method :
Below example are a common practice prior to the new feature of Caller Information:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;
namespace
ConsoleApplicationTest

{

class Program

{

static void Main(string[] args)

{

InsertLog("Main");

MethodB();

Console.ReadLine();

}
static void MethodA()


{

InsertLog("MethodA");

MethodB();

}
static void MethodB()


{ }
static void
InsertLog(string methodName)

{

Console.WriteLine("{0} called method B at {1}", methodName,
DateTime.Now);

}

}

}
In both Main and MethodA methods, method InsertLog is invoked for logging. Now we can change the
codes to be as per below lines:
using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.CompilerServices;

using System.Text;

using System.Threading.Tasks;
namespace
ConsoleApplicationTest

{

class Program

{

static void Main(string[] args)

{

//InsertLog("Main");

MethodB();

Console.ReadLine();

}
static void MethodA()


{

//InsertLog("MethodA");

MethodB();

}
static void MethodB(

[CallerMemberName] string memberName = "",

[CallerFilePath] string sourceFilePath = "",

[CallerLineNumber] int sourceLineNumber = 0)

{

InsertLog(memberName);

}
static void
InsertLog(string methodName)

{

Console.WriteLine("{0} called method B at {1}", methodName,
DateTime.Now);

}

}

}
4. Summary
The new features in C# 5.0 will help us to code more easily and improve the productivity. Have a nice
experience with the new release of Visual Studio 11!

Source: http://blogs.msdn.com/b/mvpawardprogram/archive/2012/03/26/introduction-of-new-features-in-c-5-0.aspx