code_junkie

What is new in Visual Studio 2008 vs 2005 or C# 3.0 vs C# 2.0?

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Person person = new Person();
  2. person.Name = "John Smith";
  3.  
  4. Person person = new Person() { Name = "John Smith" };
  5.  
  6. List<string> list = new List<string> { "foo", "bar" };
  7.  
  8. people.Where(delegate(person) { return person.Age >= 21;);
  9.  
  10. people.Where(person => person.Age >= 21 );
  11.  
  12. public static class StringUtilities
  13. {
  14. public static string Pluralize(this word)
  15. {
  16. ...
  17. }
  18. }
  19.  
  20. string word = "person";
  21. word.Pluralize(); // Returns "people"
  22.  
  23. var book = new { Title: "...", Cost: "..." };
  24.  
  25. public int Id { get; set; }
  26.  
  27. private int _id;
  28. public int Id {
  29. get { return _id; }
  30. set { _id = value; }
  31. }
Add Comment
Please, Sign In to add comment