What is new in C# 5?

Async CTP
When your user interface is unresponsive or your server doesn’t scale, chances are you need your code to be more asynchronous. With today’s .NET Framework and language features, though, that is easier said than done.
The Microsoft Visual Studio Async CTP proposes a new language feature in C# 5, and a new framework pattern to go with it, that will make asynchronous programming similar to – and about as straightforward as –synchronous programming.
The goal is to bring the asynchronous development experience as close to the synchronous paradigm as possible, without letting go of the ability to handle the asynchrony-specific situations. Asynchrony should be explicit and non-transparent, but in a very lightweight and non-disruptive manner. Composability, abstraction and control structures should all work as simply and intuitively as with synchronous code.

C# and Microsoft Robotics Developer Studio

Microsoft has produced an innovative new Software Development Kit (SDK) that uses C# to build software for robots, called Microsoft Robotics Developer Studio (MRDS).

What is MRDS?

MRDS includes a sophisticated 3D simulation environment for virtual robots. This free SDK includes a virtual environment, and allows a user to drive a robot just minutes after installation. The MRDS Samples site (mrdssamples.codeplex.com) hosts variety of code samples written in C#, the preferred language for MRDS. The best feature of MRDS is that it’s free for personal, academic, and development use, and its sophisticated run-time environment makes it easy to write powerful asynchronous and distributed applications. In fact, several large corporations are using this environment for non-robotics applications, for handling robust web pages and financial transactions. In its short life, MRDS has already been built into robots that participated in the DARPA Urban Challenge, and swum underwater in a robotic submarine.

Windows 8 and Future of C#

In Windows 8, C# will be used in writing applications or invoking Jupiter-based applications on the Jupiter platform.

What is Jupiter?

Jupiter is a programming platform that Microsoft will use to leverage applications for both Windows 8 and Windows Phone in the near future. It is a new user interface library for Windows. Although different from Silverlight or WPF, it will be fully compatible with both, and will use IE 10’s rendering engine. Using a XAML-based framework, it will provide access to Windows 8 elements, like sensors and networking. Jupiter apps will be packaged as AppX application types that could be common to both Windows 8 and Windows Phone 8. The AppX format is universal, and can used to deploy native Win32 apps, framework-based apps (Silverlight, WPF), Web apps, and games.

What is AppX?

AppX is a tight specification that describes how applications are packaged and installed, and was likely inspired by Silverlight’s XAP files.
Although Windows 8 will change many components of applications like how they are written and distributed, AppX is only concerned with the deployment aspect of applications.
AppX packages require an XML manifest file named AppXManifest.xml. In this file, developers will have to specify many compulsory and optional attributes of their application, which is much more than the current requirements in Windows Phone 7.

Windows Communication Foundation (WCF)

WCF is Microsoft’s unified programming model for building service-oriented applications

What makes WCF so unique?

– Programming model

– Scalability

– Interoperability

– Enhanced communication

– Enterprise enabled

Programming Model

The great thing about WCF is that there is no “right way” to get from point A to point B. If fact, WCF lets users start at point A and go to point B any way they see fit. This is because the programming model in WCF lets developers control how and when they want to code things and yet gives them the ability to do that with a minimum amount of code.
There are only a small handful of major components that a developer will need to work with to build high-class services. However, WCF also lets developers drill down to lower-level components if they desire to get more granular with their options. WCF makes this very simple. The WCF programming model lets a developer take whichever approach he or she desires. There is no single “right” way.
The programming model also combines many of the earlier technologies, such as the ones mentioned earlier in the chapter (MSMQ, COM+, WSE, and so on), into a single model.

Scalability

WCF services scale, and they scale in all directions. Not just up or out, but in all directions. They scale out via routing mechanisms and farms. Services scale up by not being tied to a single OS or processor. Services scale up by the pure ability to deploy them on bigger and better servers and taking advantage of the new processor technologies that are starting to appear.
Services scale in by way of cross-process transports, meaning on-machine and cross-machine messaging and Object-RPC.
Services scale down by interfacing and communicating with devices such as printers, scanners, faxes, and so on.

Interoperability

How sweet is it to be able to build high-class services using a single programming model and at the same time take advantage of earlier technologies, irrespective of the OS, environment, or platform? WCF services operate independent of all of these.
WCF services also take advantage of the WS architecture utilizing the already established standards as far as communication and protocols are concerned.

Enhanced Communication

Services are not picky as far as transports, formats, or much else. You as a developer can choose from a handful of transports, different message formats, and surplus of message patterns. A service can use TCP, HTTP, Named Pipes, or any other protocol to communicate.
The reason it is this way is because, as you hopefully have figured out by now, communication is completely separate from the service. They are completely independent from one another.

Enterprise Enabled

A lot of times there is a give-and-take relationship when dealing with web services, interoperability, and other important features geared toward enterprises. As a developer you have to weigh performance versus security, or reliability. At what cost does adding transactional capabilities add to your solution? Up until now, having the best of all worlds was a mere pipe dream.
Well, now it is time to wake up and smell the technology because WCF provides the ability to have security and reliability without sacrificing performance. And you can throw transactions into the mix as well.
A lot of this comes from the standards of the web service architecture, allowing you to build enterprise- class applications.

USB 3.0 and C#

USB 3.0 defines a new, 10x faster SuperSpeed bus (a bus speed of 5 Gbps) that operates parallel to the USB 2.0 bus.

How to use USB device in C#?

To use the USB device in your C# application, you can use libusb (from www.libusb.org) which is a library that gives user level applications uniform access to USB devices across many different operating systems.

There is also another library called LibUsbDotNet (from libusbdotnet.sourceforge.net) that is a .NET C# USB library for WinUsb, libusb-win32, and Linux libusb v1.x developers. All basic USB device functionality can be performed through common device classes allowing you to write OS and driver independent code.

LibUsbDotNet is a development tool written for .NET software developers who need a fast and easy way to create a custom USB driver solution for Unix-like and Windows platforms. LibUsbDotNet 2.1.0 and above supports the genuine libusb-win32 driver package. However, access to basic device information via the Windows registry is not available. LibUsbDotNet features full support for WinUSB and extended kernel level support for libusb-win32. It also allows common device classes a single code base to support multiple drivers and platforms, and includes a wizard utility for generating USB installation packages and removing devices.
LibUsbDotNet also features device discovery using either of the following criteria: VendorID or ProductID, Device Interface GUID, Revision Code, and Serial Number.

Copyright © All Rights Reserved - C# Learners