Mastering C# and .NET Framework
eBook - ePub

Mastering C# and .NET Framework

Marino Posadas

Share book
  1. 560 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Mastering C# and .NET Framework

Marino Posadas

Book details
Book preview
Table of contents
Citations

About This Book

Deep dive into C# and.NET architecture to build efficient, powerful applications

About This Book

  • Uniquely structured content to help you understand what goes on under the hood of.NET's managed code platform to master.NET programming
  • Deep dive into C# programming and how the code executes via the CLR
  • Packed with hands-on practical examples, you'll understand how to write applications to make full use of the new features of.NET 4.6, .NET Core and C# 6/7

Who This Book Is For

This book was written exclusively for.NET developers. If you've been creating C# applications for your clients, at work or at home, this book will help you develop the skills you need to create modern, powerful, and efficient applications in C#.

No knowledge of C# 6/7 or.NET 4.6 is needed to follow along—all the latest features are included to help you start writing cross-platform applications immediately. You will need to be familiar with Visual Studio, though all the new features in Visual Studio 2015 will also be covered.

What You Will Learn

  • Understand C# core concepts in depth, from sorting algorithms to the Big O notation
  • Get up to speed with the latest changes in C# 6/7
  • Interface SQL Server and NoSQL databases with.NET
  • Apprehend SOLID principles and the most relevant GoF Patterns with practical examples in C# 6.0
  • Defend C# applications against attacks
  • Use Roslyn, a self-hosted framework to compile and advanced edition in both C# and Visual basic.NET languages
  • Discern LINQ and associated Lambda expressions, generics, and delegates
  • Design a.NET application from the ground up
  • Understand the internals of a.NET assembly
  • Grasp some useful advanced features in optimization and parallelism

In Detail

Mastering C# and.NET Framework will take you in to the depths of C# 6.0/7.0 and.NET 4.6, so you can understand how the platform works when it runs your code, and how you can use this knowledge to write efficient applications. Take full advantage of the new revolution in.NET development, including open source status and cross-platform capability, and get to grips with the architectural changes of CoreCLR.

Start with how the CLR executes code, and discover the niche and advanced aspects of C# programming – from delegates and generics, through to asynchronous programming. Run through new forms of type declarations and assignments, source code callers, static using syntax, auto-property initializers, dictionary initializers, null conditional operators, and many others. Then unlock the true potential of the.NET platform. Learn how to write OWASP-compliant applications, how to properly implement design patterns in C#, and how to follow the general SOLID principles and its implementations in C# code.

We finish by focusing on tips and tricks that you'll need to get the most from C# and.NET.

This book also covers.NET Core 1.1 concepts as per the latest RTM release in the last chapter.

Style and approach

This book uses hands-on practical code examples that will take you into the depths of C# and.NET. Packed with hands-on practical examples, it is great as a tutorial, or as a reference guide.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Mastering C# and .NET Framework an online PDF/ePUB?
Yes, you can access Mastering C# and .NET Framework by Marino Posadas in PDF and/or ePUB format, as well as other popular books in Ciencia de la computación & Programación de Microsoft. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785884375

Mastering C# and .NET Framework


Table of Contents

Mastering C# and .NET Framework
Credits
About the Author
Acknowledgements
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Inside the CLR
An annotated reminder of some important computing terms
Context
The OS multitask execution model
Context types
Thread safety
State
Program state
Serialization
Process
Thread
SysInternals
Static versus dynamic memory
Garbage collector
Concurrent computing
Parallel computing
Imperative programming
Declarative programming
The evolution of .NET
.NET as a reaction to the Java World
The open source movement and .NET Core
Common Language Runtime
Common Intermediate Language
Managed execution
Components and languages
Structure of an assembly file
Program execution
Metadata
Introducing metadata with a basic Hello World
PreJIT, JIT, EconoJIT, and RyuJIT
Common Type System
Naming conventions, rules, and type access modes
Members of a type
A quick tip on the execution and memory analysis of an assembly in Visual Studio 2015
The stack and the heap
Garbage collection
Implementing algorithms with the CLR
Data structures, algorithms, and complexity
Big O Notation
An approach to performance in the most common sorting algorithms
Relevant features appearing in versions 4.5x, 4.6, and .NET Core 1.0 and 1.1
.NET 4.5.x
.NET 4.6 (aligned with Visual Studio 2015)
.NET Core 1.0
.NET Core 1.1
Summary
2. Core Concepts of C# and .NET
C# – what's different in the language?
Languages: strongly typed, weakly typed, dynamic, and static
The main differences
The true reason for delegates
The evolution in versions 2.0 and 3.0
Generics
Creating custom generic types and methods
Lambda expressions and anonymous types
Lambda expressions
It's all about signatures
The LINQ syntax
LINQ syntax is based on the SQL language
Deferred execution
Joining and grouping collections
Type projections
Extension methods
Summary
3. Advanced Concepts of C# and .NET
C# 4 and .NET framework 4.0
Covariance and contravariance
Covariance in interfaces
Covariance in generic types
Covariance in LINQ
Contravariance
Tuples: a remembrance
Tuples: implementation in C#
Tuples: support for structural equality
Tuples versus anonymous types
Lazy initialization and instantiation
Dynamic programming
Dynamic typing
The ExpandoObject object
Optional and named parameters
The Task object and asynchronous calls
C# 5.0: async/await declarations
What's new in C# 6.0
String interpolation
Exception filters
The nameof operator
The null-conditional operator
Auto-property initializers
Static using declarations
Expression bodied methods
Index initializers
What's new in C# 7.0
Binary literals and digit separators
Pattern matching and switch statements
Tuples
Decomposition
Local functions
Ref return values
Summary
4. Comparing Approaches for Programming
Functional languages
F# 4 and .NET Framework
The inevitable Hello World demo
Identifiers and scope
Lists
Function declarations
The pipeline operator
Pattern matching
Classes and types
Casting
The TypeScript language
The new JavaScript
TypeScript: a superset of JavaScript
So, what exactly is TypeScript?
Main features and coalitions
Installing the tools
Transpiling to different versions
Advantages in the IDE
A note on TypeScript's object-oriented syntax
More details and functionality
Summary
5. Reflection and Dynamic Programming
Reflection in the .NET Framework
Calling external assemblies
Generic Reflection
Emitting code at runtime
The System.CodeDOM namespace
The Reflection.Emit namespace
Interoperability
Primary Interop Assemblies
Formatting cells
Inserting multimedia in a sheet
Interop with Microsoft Word
Office apps
The Office app default project
Architectural differences
Summary
6. SQL Database Programming
The relational model
Properties of relational tables
The tools – SQL Server 2014
The SQL language
SQL Server from Visual Studio
Data access in Visual Studio
.NET data access
Using ADO.NET basic objects
Configuring the user interface
The Entity Framework data model
Summary
7. NoSQL Database Programming
A brief historical context
The NoSQL world
Architectural changes with respect to RDBMS
Querying multiple queries
The problem of nonnormalized data
Data nesting
About CRUD operations
MongoDB on Windows
File structure and default configuration
Some useful commands
Operators
Altering data – the rest of CRUD operations
Text indexes
MongoDB from Visual Studio
First demo: a simple query from Visual Studio
CRUD operations
Deletion
Insertion
Modifications and replacements
Summary
8. Open Source Programming
Historical open source movements
Other projects and initiatives
Open source code for the programmer
Other languages
The Roslyn project
Differences from traditional compilers
Getting started with Roslyn
A first look at Microsoft Code Analysis Services
Code Analyzers
An entire open source sample for you to check: ScriptCS
A basic project using Microsoft.CodeAnalysis
The first approach to code refactoring
Debugging and testing the demo
TypeScript
Debugging TypeScript
Debugging TypeScript with Chrome
Interfaces and strong typing
Implementing namespaces
Declarations, scope, and Intellisense
Scope and encapsulation
Classes and class inheritance
Functions
Arrays and interfaces
More TypeScript in action
The DOM connection
Summary
9. Architecture
The election of an architecture
The Microsoft platform
A universal platform
The MSF application model
The Team Model
The Governance Model
The Risk Model
Risk evaluation
Risk assessment
Risk action plans
CASE tools
The role of Visio
A first example
The database design
Creating the demo application in Visual Studio
Website design
Reports
Many other options
BPMN 2.0 (Business Process Model and Notation)
UML standard support
Visual Studio architecture, testing, and analysis tools
Application's architecture using Visual Studio
Class diagrams
Testing
Testing our application in Visual Studio
The Analyze menu
The end of the life cycle – publishing the solution
Summary
10. Design Patterns
The origins
The SOLID principles
Single Responsibility principle
An example
Open/Closed principle
Back to our sample
Liskov Substitution principle
Back to the code again
Other implementations of LSP in .NET (Generics)
Interface Segregation principle
Dependency Inversion principle
A final version of the sample
Design patterns
Singleton
The Factory pattern
The Adapter pattern
The Façade pattern
The Decora...

Table of contents