Blog

Lambda Expressions (C# Programming Guide)

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:59

User Rating: / 1
PoorBest 

Source: MSDN

A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.

All lambda expressions use the lambda operator =>, which is read as "goes to". The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression or statement block. The lambda expression x => x * x is read "x goes to x times x." This expression can be assigned to a delegate type as follows: 

 

Extension Methods (C# Programming Guide)

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:54

Source: MSDN

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. Extension methods are a special kind of static method, but they are called as if they were instance methods on the extended type. For client code written in C# and Visual Basic, there is no apparent difference between calling an extension method and the methods that are actually defined in a type.

Boxing and Unboxing

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:28

Source:

Introduction

In this article I will explain the concepts of Boxing and UnBoxing. C# provides us with Value types and Reference Types. Value Types are stored on the stack and Reference types are stored on the heap. The conversion of value type to reference type is known as boxing and converting reference type back to the value type is known as unboxing.

 

Fixed Size Buffers (C# Programming Guide)

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:26

Source: MSDN

In C# 2.0, you can us the fixed statement to create a with a fixed size array in a data structure. This is useful when working with existing code, such as code written in other languages, pre-existing DLLs or COM projects. The fixed array can take any of the attributes or modifiers that are allowed for regular struct members. The only restriction is that the array type must be bool, byte, char, short, int, long, sbyte, ushort, uint, ulong, float, or double.

Inline Warning Control

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:24

Source: blog.msdn.com

Another feature that we added for Whidbey is the ability to selectively disable warnings within your code. For example:

#pragma warning disable 135

// Disable warning CS135 in this block

#pragma warning restore 135


 

Namespace Alias Qualifier (C# Programming Guide)

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:19

Source: MSDN

The ability to access a member in the global namespace is useful when the member might be hidden by another entity of the same name.

For example, in the following code, Console resolves to TestApp.Console instead of to the Console type in the System namespace.

extern alias (C# Reference)

Blog - Programming

Written by Thong D. Nguyen Wednesday, 02 March 2011 09:14

Source: MSDN

It can sometimes be necessary to reference two versions of assemblies that have the same fully-qualified type names, for example when you need to use two or more versions of an assembly in the same application. By using an external assembly alias, the namespaces from each assembly can be wrapped inside root-level namespaces named by the alias, allowing them to be used in the same file.

 

Page 1 of 4

«StartPrev1234NextEnd»

Idioms

  • When is Rome, do as the Romans do. (Nhập gia tùy tục)
  • Doing nothing is doing ill. (Nhàn cư vi bất thiện)

Who's online

We have 10 guests online

Location

 38.107.179.220
 38.107.179.220
Search Bot
 unknown unkno

Relax

Site Ranking


Increase your website traffic with Attracta.com

Quick Search

This Day in History

Poll

What is your current operating system?
 

Weather

Newsletter

Copyright © 2012 Thong D. Nguyen. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.