SetConsoleTextAttribute() can change the color of the console.
Posts tonen met het label visual studio. Alle posts tonen
Posts tonen met het label visual studio. Alle posts tonen
donderdag 5 maart 2009
Visual studio addin - extra feature on errorlist
This code puts an extra popup commandbar on the errorlist with all the error descriptions as commandbarbuttons, each button has a lookup event (google lookup).
maandag 2 maart 2009
New C# 4.0 features
1) dynamic
"most anything that you could do with some variable, you can do with a dynamic variable."
static double SumDouble(double a, double b) { return a + b; }
static decimal SumDecimal(decimal a, decimal b) {return a + b;}
this can now be writen as :
static dynamic Sum1(dynamic a, dynamic b) { return a + b; }
or more generic :
static dynamic Sum2(T1 a, T2 b) {
dynamic ad = a;
dynamic bd = b;
return ad + bd;
}
more:
Dynamically Typed Objects with C# 4.0 (xml example)
2) Named arguments, optional arguments, and default values
By giving method parameters default values.
list.SearchForContacts(age:26);
or
list.SearchForContacts(address:"home", name:"sam", age:30);
"most anything that you could do with some variable, you can do with a dynamic variable."
static double SumDouble(double a, double b) { return a + b; }
static decimal SumDecimal(decimal a, decimal b) {return a + b;}
this can now be writen as :
static dynamic Sum1(dynamic a, dynamic b) { return a + b; }
or more generic :
static dynamic Sum2
dynamic ad = a;
dynamic bd = b;
return ad + bd;
}
more:
Dynamically Typed Objects with C# 4.0 (xml example)
2) Named arguments, optional arguments, and default values
By giving method parameters default values.
public class ContactListU can then call the method like this:
{
List<Contact> SearchForContacts(
string name = "any",
int age = -1,
string address = "any") { ... }
static void Main()
{
ContactList list = new ContactList();
var x = list.SearchForContacts(age:26);
}
}
list.SearchForContacts(age:26);
or
list.SearchForContacts(address:"home", name:"sam", age:30);
Abonneren op:
Posts (Atom)