C# 4.0

Ayos tong  C# 4.0 ah!

Konti lang to ha.. wag ka excited..

Dynamic Keyword – ito bago to. Astig. Lagay ka lang ng using System.Dynamic pwede ka na magsulat ng ganito:


dynamic
tao = new ExpandoObject();
tao.Name = "Jon Limjap";
tao.Phone = "917-516-2341";

Covariance and Contravariance

Eto dati error to pero ngayon pwede na

IEnumerable<Object> objects = new List<String>();


Optional (or Default) Parameters

Tagal na meron sa VB nito eh, ewan ko ba bakit ngayon lang nagkaron sa C#

public static void fuu(int optional = 0)
{
//bahala ka
}

Method calls:

fuu();
fuu(10);

Named Arguments

Naalala ko si lattex dito sa bagong feature na ito. Nagtanong kasi ako sa kanyan minsan kung bakit me error ako eh yung function ko kasi baliktad pagkakalagay ko ng parameters, sa una ko nailagay yung output parameters (oo na! violation of standard practice!) Pero pwede na ngayon

var sample = new List<String>();
sample.InsertRange(collection:
new List<String>(), index:
0);
sample.InsertRange(index: 0, collection: new List<String>());

Yun mga bago sa IDE tsaka ko na i-blog pero ok naman so far. Astig!

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s