Skip to main content

Professional C# 6 and .NET Core 1.0

Professional C# 6 and .NET Core 1.0

Christian Nagel

ISBN: 978-1-119-09663-4

Apr 2016

1536 pages

$39.99

Description

A true professional's guide to C# 6

Professional C# 6 and .NET Core 1.0 provides complete coverage of the latest updates, features, and capabilities, giving you everything you need for C#. Get expert instruction on the latest changes to Visual Studio 2015, Windows Runtime, ADO.NET, ASP.NET, Windows Store Apps, Windows Workflow Foundation, and more, with clear explanations, no-nonsense pacing, and valuable expert insight. This incredibly useful guide serves as both tutorial and desk reference, providing a professional-level review of C# architecture and its application in a number of areas. You'll gain a solid background in managed code and .NET constructs within the context of the 2015 release, so you can get acclimated quickly and get back to work.

The new updates can actively streamline your workflow, with major changes including reimagined C# refactoring support, a new .NET Web app stack, and the .NET compiler platform that makes C# and Visual Basic compilers available as APIs. This book walks you through the changes with a comprehensive C# review.

  • Explore the new Visual Studio templates for ASP.NET Core 1.0, Web Forms, and MVC
  • Learn about the networking switch to HttpClient and ASP.NET Web API's replacement of WCF Data Services
  • Work with the latest updates to the event log, Windows Runtime 2.0, and Windows 8.1 deployment and localization
  • Dig deep into the new .NET 5.0 GC behaviors and the Migrations addition to ADO.NET

Microsoft has stepped up both the cadence and magnitude of their software releases. Professional C# 6 and .NET Core 1.0 shows you everything you need to know about working with C# in a real-world context.

Related Resources

Instructor

Request an Evaluation Copy for this title

INTRODUCTION li

PART I: THE C# LANGUAGE

CHAPTER 1: .NET APPLICATION ARCHITECTURES 3

CHAPTER 2: CORE C# 31

CHAPTER 3: OBJECTS AND TYPES 73

CHAPTER 4: INHERITANCE 103

CHAPTER 5: MANAGED AND UNMANAGED RESOURCES 123

CHAPTER 6: GENERICS 159

CHAPTER 7: ARRAYS AND TUPLES 183

CHAPTER 8: OPERATORS AND CASTS 205

CHAPTER 9: DELEGATES, LAMBDAS, AND EVENTS 243

CHAPTER 10: STRINGS AND REGULAR EXPRESSIONS 267

CHAPTER 11: COLLECTIONS 287

CHAPTER 12: SPECIAL COLLECTIONS 319

CHAPTER 13: LANGUAGE INTEGRATED QUERY 339

CHAPTER 14: ERRORS AND EXCEPTIONS 371

CHAPTER 15: ASYNCHRONOUS PROGRAMMING 395

CHAPTER 16: REFLECTION, METADATA, AND DYNAMIC PROGRAMMING 417

PART II: .NET CORE AND WINDOWS RUNTIME

CHAPTER 17: VISUAL STUDIO 2015 455

CHAPTER 18: .NET COMPILER PLATFORM 511

CHAPTER 19: TESTING 541

CHAPTER 20: DIAGNOSTICS AND APPLICATION INSIGHTS 569

CHAPTER 21: TASKS AND PARALLEL PROGRAMMING 591

CHAPTER 22: TASK SYNCHRONIZATION 613

CHAPTER 23: FILES AND STREAMS 641

CHAPTER 24: SECURITY 681

CHAPTER 25: NETWORKING 703

CHAPTER 26: COMPOSITION 749

CHAPTER 27: XML AND JSON 781

CHAPTER 28: LOCALIZATION 819

PART III: WINDOWS APPS

CHAPTER 29: CORE XAML 849

CHAPTER 30: STYLING XAML APPS 871

CHAPTER 31: PATTERNS WITH XAML APPS 923

CHAPTER 32: WINDOWS APPS: USER INTERFACES 951

CHAPTER 33: ADVANCED WINDOWS APPS 991

CHAPTER 34: WINDOWS DESKTOP APPLICATIONS WITH WPF 1035

CHAPTER 35: CREATING DOCUMENTS WITH WPF 1101

CHAPTER 36: DEPLOYING WINDOWS APPS 1125

PART IV: WEB APPLICATIONS AND SERVICES

CHAPTER 37: ADO.NET 1143

CHAPTER 38: ENTITY FRAMEWORK CORE 1159

CHAPTER 39: WINDOWS SERVICES 1189

CHAPTER 40: ASP.NET CORE 1219

CHAPTER 41: ASP.NET MVC 1255

CHAPTER 42: ASP.NET WEB API 1311

CHAPTER 43: WEBHOOKS AND SIGNALR 1337

CHAPTER 44: WINDOWS COMMUNICATION FOUNDATION 1357

CHAPTER 45: DEPLOYING WEBSITES AND SERVICES 1401

INDEX 1417

ReadMe
Download
Chapter 01
Download
Chapter 02
Download
Chapter 03
Download
Chapter 04
Download
Chapter 05
Download
Chapter 06
Download
Chapter 07
Download
Chapter 08
Download
Chapter 09
Download
Chapter 10
Download
Chapter 11
Download
Chapter 12
Download
Chapter 13
Download
Chapter 14
Download
Chapter 15
Download
Chapter 16
Download
Chapter 17
Download
Chapter 18
Download
Chapter 19
Download
Chapter 20
Download
Chapter 21
Download
Chapter 22
Download
Chapter 23
Download
Chapter 24
Download
Chapter 25
Download
Chapter 26
Download
Chapter 27
Download
Chapter 28
Download
Chapter 29
Download
Chapter 30
Download
Chapter 31
Download
Chapter 32
Download
Chapter 33
Download
Chapter 34
Download
Chapter 35
Download
Chapter 36
Download
Chapter 37
Download
Chapter 38
Download
Chapter 39
Download
Chapter 40
Download
Chapter 41
Download
Chapter 42
Download
Chapter 43
Download
Chapter 44
Download
Chapter 45
Download
Chapter 46
Download
Chapter 47
Download
All code files
Download
Bonus Chapters
Download
ChapterPageDetailsDatePrint Run
15Errata in Text
Currently reads:
Now, .NET Native is also available with other .NET Core applications.

Should be:
.NET Native will also be available with other .NET Core applications. However, this feature did not make it into version 1 of .NET Core and will be available with a future version.
2-Jun-16

19Errata in Text
Just before the title “Building the Application”, this should be added to the preceding section:
The dotnet repl command is not available with Preview 2 of the tools, but it will be available at a later time as an extension.

20Errata in code
Currently reads:
compilationOptions

Should be:
buildOptions

22Errata in Text
Currently reads in Note:
…run the application with dotnet restore, dotnet compile, and dotnet run

Should be:
…run the application with dotnet restore, dotnet build, and dotnet run

9264Errata in text
Currently Reads:
WriteLine(“\{_name}: car \{e.Car} is new”);

Should Read:
WriteLine($“{_name}: car {e.Car} is new”);
14-Jun-16

13370Errata in text
Text before the summary currently reads:
Expression<Func<TSource, bool>gt;
Should Read:
Expression<Func<TSource, bool> >
30-Jun-16

16437Errata in code
In second code block (project.json):
currently reads
“compilationOptions”: {

should be
“buildOptions”: {
6-Jun-16

16437Errata in code
In third code block (Program.cs) ? assembly loading is now easier
Currently reads
private static object GetCalculator() { IAssemblyLoadContext loadContext = PlatformServices.Default.AssemblyLoadContext.Default; using (PlatformServices.DefaultAssemblyLoaderContainer.AddLoader( new DirectoryLoader(CalculatorLibPath, loadContext))) { Assembly assembly = Assembly.Load(new AssemblyName(CalculatorLibName)); Type type = assembly.GetType(CalculatorTypeName); return Activator.CreateInstance(type); } }
should read
private static object GetCalculator() { Assembly assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(CalculatorLibPath); Type type = assembly.GetType(CalculatorTypeName); return Activator.CreateInstance(type); }
6-Jun-16

24697Errata in code
In code block in the lower part of the page
Currently reads

public static MySafe InitProtection() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDataProtection(); serviceCollection.ConfigureDataProtection(c => c.PersistKeysToFileSystem(new DirectoryInfo( . )) .SetDefaultKeyLifetime(TimeSpan.FromDays(20)) .ProtectKeysWithDpapi() ); IServiceProvider services = serviceCollection.BuildServiceProvider(); return ActivatorUtilities.CreateInstance(services); }
Should read

public static MySafe InitProtection() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo( . )) .SetDefaultKeyLifetime(TimeSpan.FromDays(20)) .ProtectKeysWithDpapi(); IServiceProvider services = serviceCollection.BuildServiceProvider(); return ActivatorUtilities.CreateInstance(services); }
6-Jun-16

381166Errata in code
In Entity Framework
Currently reads:
public class BooksContext : DbContext { public DbSet Books { get; set; } }
should read
public class BooksContext : DbContext { public BooksContext(DbContextOptions options) : base(options) { } public DbSet Books { get; set; } }
6-Jun-16

381169Errata in code
In bottom of page
Currently reads
tools : { dotnet-ef : 1.0.0-* }
Should read
tools : { Microsoft.EntityFrameworkCore.Tools : { version : 1.0.0-* , imports : portable-net452+win81 } }
6-Jun-16

401248Errata in Text
In the section before the first code snippet:
Text currently reads:
?add the NuGet package Microsoft.AspNet.Session.
Should be:
?add the NuGet package Microsoft.AspNetCore.Session.

401248Errata in Text
In the section before the first code snippet:
Text currently reads:
?method AddCaching adds the following cache service?
Should read:
?method AddDistributedCache adds the cache service?
4-Jan-17

401248Errata in code
In the first code snippet:
Currently reads:
services.AddCaching();
Should read:
services.AddDistributedCache();
4-Jan-17

1332Errata in Text
In text before the first code snippet
Currently reads:
ConfigureSwaggerDocument configures the title, description, and the API version. ConfigureSwaggerSchema defines how the generated JSON schema should look.
Should read:
ConfigureSwaggerGen configures the title, description, and the API version, and how the generated JSON schema should look.
13-7-16

1332Errata in code
The first code snippet:
Currently reads:
services.ConfigureSwaggerDocument(options => { options.SingleApiVersion(new Info { Version = "v1", Title = "Book Chapters", Description = "A sample for Professional C# 6" }); options.IgnoreObsoleteActions = true; }); services.ConfigureSwaggerSchema(options => { options.DescribeAllEnumsAsStrings = true; options.IgnoreObsoleteProperties = true; }
Should read:
services.ConfigureSwaggerGen(options => { options.SingleApiVersion(new Info { Version = v1 , Title = Book Chapters , Description = A sample for Professional C# 6 }); options.IgnoreObsoleteActions(); options.IgnoreObsoleteProperties(); options.DescribeAllEnumsAsStrings(); });
13-7-16

1332Errata in Text
Text before the second code snippet:
Currently reads:
The extension method UseSwaggerGen specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwaggerGen is…
Should read:
The extension method UseSwagger specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwagger is…
13-7-16

1332Errata in Text
Text before the second code snippet:
Currently reads:
The extension method UseSwaggerGen specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwaggerGen is…
Should read:
The extension method UseSwagger specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwagger is…
13-7-16

1332Errata in code
And the second code snippet on page 1332
Currently reads:
app.UseSwaggerGen(); app.UseSwaggerUI();
Should read:
app.UseSwagger(); app.UseSwaggerUI();
13-7-16