“Effective C#” - PowerPoint PPT Presentation

effective c n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
“Effective C#” PowerPoint Presentation
Download Presentation
“Effective C#”

play fullscreen
1 / 106
“Effective C#”
175 Views
Download Presentation
lynley
Download Presentation

“Effective C#”

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. “Effective C#” ++ And a little VB Brendan Duffy

  2. Wagner • Effective C# • Addison Wesley • 300 pages

  3. If you're interested in, or currently working with, .NET and are tempted to skip past this book as Just Another C# Reference Book, think again. Wagner's book is a great resource because it covers concepts which run across the entire .NET Framework regardless of which language you're working with. While this book focuses on C#, VB.NET developers can benefit from some of the text within as well. Excerpts from Jim Holmes review, Dayton .NET Users Group

  4. I also think this book speaks to a wide range of readers. Seasoned developers will blow through this content, fine-tuning their coding methods or starting new ones. …New developers also can greatly benefit from this book by using it to properly form development habits early in their careers. Excerpts from Jim Holmes review, Dayton .NET Users Group

  5. Wagner's writing style is clear and concise. He occasionally comes across as brusque … but those instances are few and far between. The rest of the book's voice is terrific. More important is the weight of Wagner's knowledge and experience. One real drawback is a large number of typographical errors, … I would have expected better proofreaders at AW. Excerpts from Jim Holmes review, Dayton .NET Users Group

  6. The book is well organized into six chapters, each hitting a specific area in C#. Within each chapter, Wagner covers six to ten items, each item focusing on one specific "mini topic," as Wagner calls them. Each item includes code snippets to demonstrate recommended approaches. Excerpts from Jim Holmes review, Dayton .NET Users Group

  7. Balena and Dimauro • Practical Guidelines and Best Practices for Microsoft Visual Basic and Visual C# Developers • Microsoft Press • 570 pages

  8. This book, which is language agnostic, contains a large number of items, which ranging from a brief few lines to several pages in length. The breadth of the coverage is extensive and allows easy scanning. The guidelines are easy to understand with a limited number that are debateable. Almost all items include a concise paragraph outlining why the practice is recommended. The writing style is clear and avoids the cookbook style, only including code snippets where needed.

  9. “Most recommendations are very practical and can easily be applied immediately. In addition many of the suggestions are put in context with a brief discussion over the pros and cons. … The book's tailored towards practicality. It is simply structured, uses basic and direct language and takes clear positions. That makes it easy and fun to read - yet it provides remarkably good information, not firstly on grand concepts, but on many small things that often get overlooked. It's the sort of book you take where ever you go when you just have a couple minutes to read. Open a random page and always get a little ‘aha’”. Excerpt from an Amazon review

  10. “This is an intermediate level book. It is intended for the programmer who knows the language but is moving up to bigger projects. … Your own experience will likewise lead you to programming methods that may differ from their Guidelines. … On the whole, any programmer reading this book will come away with some guidelines of the ‘Gee, why didn't I think of that’ variety.” Excerpt from an Amazon review

  11. Always use _____ instead of accessible data members. a) Variables b) Properties c) Methods d) Delegates Effective C#, Wagner, p 1

  12. The Option Strict directive. Projects and Solutions, 23 items When should you use Option Strict Off? Practical Guidelines and Best Practices, Balena & Dimauro, p 10

  13. Prefer _____ to const. a) set b) mutable c) get d) readonly Effective C#, Wagner, p 12

  14. Line Wrapping. Spaces and Indentation, 8 items What is the shortcut key for toggling word wrapping in VS? Practical Guidelines and Best Practices, Balena & Dimauro, p 14

  15. Prefer the is or as operators to _____ . a) equivalence b) assignment c) casts d) down casting Effective C#, Wagner, p 17

  16. TODO and HACK comment tokens. Comments, 19 items How do you toggle display of these items in the task list window? Practical Guidelines and Best Practices, Balena & Dimauro, p29

  17. Use _____ instead of #if. a) #define b) Conditional attributes c) String formatting d) Regex expressions Effective C#, Wagner, p 25

  18. CLS compliant assemblies Assemblies and Resources, 14 items Does VB play well with this attributte? Practical Guidelines and Best Practices, Balena & Dimauro, p 33

  19. Always provide _____ ( ) . a) Equals b) GetHashCode c) ToString d) MemberwiseClone Effective C#, Wagner, p 31

  20. First level namespace. Namespaces, 12 items What should you use as a first level namespace? Practical Guidelines and Best Practices, Balena & Dimauro, p 43

  21. _____ value and reference types . a) Convert between b) Distinguish between c) Derive from d) Overload constructors for Effective C#, Wagner, p 38

  22. Nested types. Types, 24 items Should they be public? Practical Guidelines and Best Practices, Balena & Dimauro, p 53

  23. Prefer _____ value types. a) Nullable b) Transactional c) Polymorpic Granular d) Immutable atomic Effective C#, Wagner, p 44

  24. Base classes vs interfaces. Inheritance, 21 items Which should you favour? Practical Guidelines and Best Practices, Balena & Dimauro, p 59

  25. Understand the pitfalls of _____ . a) ToString b) GetHashCode c) Equals d) MemberwiseClone Effective C#, Wagner, p 63

  26. Interface immutability. Interfaces, 19 items Are there exceptions? Practical Guidelines and Best Practices, Balena & Dimauro, p 77

  27. Ensure that _____ is a valid state for reference types. a) 0 b) null c) NaN d) Error Effective C#, Wagner, p 51

  28. Equals overload in value types. Structures, 7 items Is this a performance issue? Practical Guidelines and Best Practices, Balena & Dimauro, p 97

  29. Prefer _____ loops. a) do b) for c) foreach d) while Effective C#, Wagner, p 70

  30. Member names in an enum type. Enum Types, 13 items Should they have a common prefix? Practical Guidelines and Best Practices, Balena & Dimauro, p 102

  31. Prefer variable _____ to assignment statements. a) methods b) properties c) initializers d) modifiers Effective C#, Wagner, p 82

  32. Invoking a method through reflection. Attribute Types and Reflection, 12 items What is the most efficient way to achieve this? Practical Guidelines and Best Practices, Balena & Dimauro, p 114

  33. Utilize constructor _____ . a) chaining b) Return values c) Default parameters d) linking Effective C#, Wagner, p 87

  34. Hungarian notation. Fields and Variables, 27 items What is the real purpose of hungarian notation? Practical Guidelines and Best Practices, Balena & Dimauro, p 116

  35. Utilize _____ for resource cleanup. a) destructors b) dispose c) using d) finalizers Effective C#, Wagner, p 93

  36. Properties that return arrays. Properties, 14 items How do you make the elements of an array immutable? Practical Guidelines and Best Practices, Balena & Dimauro, p 136

  37. Minimize _____. a) Garbage b) Disposes c) Generations d) instances Effective C#, Wagner, p 100

  38. Factory method names. Methods, 35 items How should you name factory methods? Practical Guidelines and Best Practices, Balena & Dimauro, p 154

  39. Minimize _____. a) Stack size b) structs c) Early-binds d) boxing Effective C#, Wagner, p 103

  40. Calling virtual methods from inside a constructor. Constructors, 19 items Will this work? Practical Guidelines and Best Practices, Balena & Dimauro, p 175

  41. Implement the standard _____ pattern. a) Dispose b) Garbage Collection c) Finalize d) Resurrection Effective C#, Wagner, p 109

  42. Dispose vs Close method. Dispose and Finalize methods, 11 items When should you use the Close method name instead of Dispose? Practical Guidelines and Best Practices, Balena & Dimauro, p 180

  43. Prefer defining and implementing interfaces to _____. a) inheritance b) polymorphism c) encapsulation d) abstraction Effective C#, Wagner, p 118

  44. Events in serializable classes Delegate and Events, 23 items Why do you need to Implement ISerializable in this case? Practical Guidelines and Best Practices, Balena & Dimauro, p 201

  45. Express callbacks with _____ . a) Unsafe code b) events c) Delegates d) interop Effective C#, Wagner, p 129

  46. Go to keyword. Execution Flow, 26 items Where is this OK to use? Practical Guidelines and Best Practices, Balena & Dimauro, p 214

  47. Define outgoing interfaces with _____ . a) Events b) delegates c) MarshallByRef d) Sinks Effective C#, Wagner, p 131

  48. Rethrowing original exceptions. Exception Handling, 29 items How is this done, and where? Practical Guidelines and Best Practices, Balena & Dimauro, p 230

  49. Avoid _____ references to internal class objects. a) creating b) returning c) disposing d) Calling Effective C#, Wagner, p 137

  50. Conversion of boolean values to integers. Numeric Types, 17 items Why should this be avoided? Practical Guidelines and Best Practices, Balena & Dimauro, p 243