0
  1. Trang chủ >
  2. Công Nghệ Thông Tin >
  3. Kỹ thuật lập trình >

Effective C#50 Specific Ways to Improve Your C# 2nd phần 1 docx

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 1 ppt

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 1 ppt

... Types 11 0Item 20: Prefer Immutable Atomic Value Types 11 4Chapter 3 Expressing Designs in C# 12 5Item 21: Limit Visibility of Your Types 12 6Item 22: Prefer Defining and Implementing Interfaces to ... this[int x, int y] {Item 1: Use Properties Instead of Accessible Data Members ❘5From the Library of Wow! eBookptg Effective C# 50 Specific Ways to Improve Your C# Second EditionBill WagnerUpper ... Prefer readonly to const ❘ 11 From the Library of Wow! eBookptg❘ContentsxiIntroduction xiiiChapter 1 C# Language Idioms 1 Item 1: Use Properties Instead of Accessible Data Members 1 Item 2:...
  • 35
  • 345
  • 1
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 2 pptx

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 2 pptx

... y));storage.Sort((point1, point2) => (point2.Item1*point2.Item1 + point2.Item2 * point2.Item2).CompareTo( point1.Item1 * point1.Item1 + point1.Item2 * point1.Item2));return storage; } private static IEnumerable<Tuple<int, ... {Customer c = arg as Customer; if (c == null)return arg.ToString(); return string.Format("{0,50}, {1, 15}, {2 ,10 :C}",c.Name, c.ContactPhone, c.Revenue); }34 ❘Chapter 1 C# Language ... work with customer objects to modify the name:Customer c1 = new Customer("Acme Products"); myDictionary.Add(c1, orders); // Oops, the name is wrong: Customer c2 = c1.ChangeName("Acme...
  • 34
  • 373
  • 0
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 3 docx

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 3 docx

... helper method. Stop that, too. When you find that multiple constructors contain the same logic, fac-tor that logic into a common constructor instead. You’ll get the benefits ofItem 14 : Minimize ... logic to initialize static member variables, create a static constructor.Implementing the singleton pattern in C# is the most frequent use of a static constructor. Make your instance constructor ... are hard to find because the compiler generates code to convert these objects. Avoid conversion operators in your APIs.Item 10 : Use Optional Parameters to Minimize Method Overloads C# now has...
  • 34
  • 349
  • 0
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 4 pdf

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 4 pdf

... "", "Anytown", "IL", 611 11) ;// To change, re-initialize: a2 = new Address2(a1.Line1,a1.Line2, "Ann Arbor", "MI", 4 810 3);The value of a1 is in one of ... have performed 10 1 allocations—and 10 1 allo-cations take more time than 1 allocation. Allocating a large number ofItem 18 : Distinguish Between Value Types and Reference Types ❘ 10 7From the ... structure refers to the same array storage (phones) allocated outside the object. Developers can modify your immutable structure through another variable that refers to the same storage. To remove...
  • 34
  • 436
  • 0
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 6 pptx

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 6 pptx

... Relational Operators. public static bool operator <(Customer left,Customer right) {return left.CompareTo(right) < 0; } public static bool operator <=(Customer left,Customer right) ... (!(obj is Customer)) throw new ArgumentException("Argument is not a Customer", "obj"); Customer otherCustomer = (Customer)obj; return this.CompareTo(otherCustomer);} #endregion// ... you need to Item 27: Prefer Making Your Types Serializable ❘ 15 9From the Library of Wow! eBookptgpublic static bool operator >=(Customer left,Customer right) {return left.CompareTo(right)...
  • 34
  • 369
  • 0
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 7 ppt

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 7 ppt

... ptgtesting element: 11 testing element: 12 testing element: 13 testing element: 14 testing element: 15 testing element: 16 testing element: 17 testing element: 18 testing element: 19 testing ... element: 10 projecting an element: 10 testing element: 11 testing element: 12 testing element: 13 testing element: 14 testing element: 15 testing element: 16 testing element: 17 testing ... 17 testing element: 18 testing element: 19 testing element: 15 2 testing element: 15 3 testing element: 15 4 testing element: 15 5 testing element: 15 6 testing element: 15 7 testing element:...
  • 34
  • 314
  • 0
Effective C#50 Specific Ways to Improve Your C# Second Edition phần 8 pps

Effective C#50 Specific Ways to Improve Your C# Second Edition phần 8 pps

... want to bring those dynamic objects back into the static type system used by most of your C# code. That’s going to require either a cast or a conver-sion operation:answer = Add(5, 12 .3); ... AddExpressionWithConversion<T1, T2, TResult>(T1 left, T2 right) {var leftOperand = Expression.Parameter(typeof(T1), "left");Expression convertedLeft = leftOperand; if (typeof(T1) != typeof(TResult)) ... public static TResult AddExpression<T1, T2, TResult>(T1 left, T2 right) {var leftOperand = Expression.Parameter(typeof(T1), "left");var rightOperand = Expression.Parameter(typeof(T2),...
  • 34
  • 380
  • 0
Effective C#50 Specific Ways to Improve Your C# 2nd phần 3 pps

Effective C#50 Specific Ways to Improve Your C# 2nd phần 3 pps

... static constructors are called. And, yes, your static initializers execute before the base class’s static constructor.The CLR calls your static constructor automatically before your type is first ... complicated logic to initialize the singleton:public class MySingleton2 {private static readonly MySingleton2 theOneAndOnly;static MySingleton2(){theOneAndOnly = new MySingleton2();}public ... that leads to unmaintainable code.If you want to convert another type into your type, use a constructor. This more clearly reflects the action of creating a new object. Conversion oper-ators can...
  • 34
  • 274
  • 0

Xem thêm

Từ khóa: ways to improve your english grammarways to improve your english reading skills101 ways to improve your business writing101 ways to improve your business101 ways to improve your business english pdfways to improve your english writing skillsNghiên cứu sự hình thành lớp bảo vệ và khả năng chống ăn mòn của thép bền thời tiết trong điều kiện khí hậu nhiệt đới việt namNghiên cứu tổ chức pha chế, đánh giá chất lượng thuốc tiêm truyền trong điều kiện dã ngoạiNghiên cứu tổ hợp chất chỉ điểm sinh học vWF, VCAM 1, MCP 1, d dimer trong chẩn đoán và tiên lượng nhồi máu não cấpNghiên cứu tổ chức chạy tàu hàng cố định theo thời gian trên đường sắt việt namBiện pháp quản lý hoạt động dạy hát xoan trong trường trung học cơ sở huyện lâm thao, phú thọGiáo án Sinh học 11 bài 13: Thực hành phát hiện diệp lục và carôtenôitQuản lý hoạt động học tập của học sinh theo hướng phát triển kỹ năng học tập hợp tác tại các trường phổ thông dân tộc bán trú huyện ba chẽ, tỉnh quảng ninhPhát triển du lịch bền vững trên cơ sở bảo vệ môi trường tự nhiên vịnh hạ longNghiên cứu, xây dựng phần mềm smartscan và ứng dụng trong bảo vệ mạng máy tính chuyên dùngTìm hiểu công cụ đánh giá hệ thống đảm bảo an toàn hệ thống thông tinSở hữu ruộng đất và kinh tế nông nghiệp châu ôn (lạng sơn) nửa đầu thế kỷ XIXQuản lý nợ xấu tại Agribank chi nhánh huyện Phù Yên, tỉnh Sơn La (Luận văn thạc sĩ)BT Tieng anh 6 UNIT 2chuong 1 tong quan quan tri rui roGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtGiáo án Sinh học 11 bài 14: Thực hành phát hiện hô hấp ở thực vậtTrách nhiệm của người sử dụng lao động đối với lao động nữ theo pháp luật lao động Việt Nam từ thực tiễn các khu công nghiệp tại thành phố Hồ Chí Minh (Luận văn thạc sĩ)Chiến lược marketing tại ngân hàng Agribank chi nhánh Sài Gòn từ 2013-2015TÁI CHẾ NHỰA VÀ QUẢN LÝ CHẤT THẢI Ở HOA KỲQUẢN LÝ VÀ TÁI CHẾ NHỰA Ở HOA KỲ