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# Second Edition phần 1 ppt

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 Edition Bill 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)) ... example showed you how to parse expressions to convert code (or at least expressions that define code) into data elements you can use to implement runtime algorithms. The second example shows...
  • 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 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 skills50 ways to reach your goalsNghiên cứu vật liệu biến hóa (metamaterials) hấp thụ sóng điện tử ở vùng tần số THzGiáo án Sinh học 11 bài 13: Thực hành phát hiện diệp lục và carôtenôitGiáo án Sinh học 11 bài 13: Thực hành phát hiện diệp lục và carôtenôitGiáo án Sinh học 11 bài 13: Thực hành phát hiện diệp lục và carôtenôitĐỒ ÁN NGHIÊN CỨU CÔNG NGHỆ KẾT NỐI VÔ TUYẾN CỰ LY XA, CÔNG SUẤT THẤP LPWANNGHIÊN CỨU CÔNG NGHỆ KẾT NỐI VÔ TUYẾN CỰ LY XA, CÔNG SUẤT THẤP LPWAN SLIDETrả hồ sơ điều tra bổ sung đối với các tội xâm phạm sở hữu có tính chất chiếm đoạt theo pháp luật Tố tụng hình sự Việt Nam từ thực tiễn thành phố Hồ Chí Minh (Luận văn thạc sĩ)Phá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ạ longPhát hiện xâm nhập dựa trên thuật toán k meansNghiê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ùngNghiên cứu khả năng đo năng lượng điện bằng hệ thu thập dữ liệu 16 kênh DEWE 5000Định tội danh từ thực tiễn huyện Cần Giuộc, tỉnh Long An (Luận văn thạc sĩ)Tìm hiểu công cụ đánh giá hệ thống đảm bảo an toàn hệ thống thông tinThơ nôm tứ tuyệt trào phúng hồ xuân hươngQuả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 2Giáo án Sinh học 11 bài 15: Tiêu hóa ở động vậtNguyên tắc phân hóa trách nhiệm hình sự đối với người dưới 18 tuổi phạm tội trong pháp luật hình sự Việt Nam (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Ỳ