SlideShare a Scribd company logo
Professional C and NET 2021st Edition Christian
Nagel install download
https://ebookmeta.com/product/professional-c-and-net-2021st-
edition-christian-nagel/
Download more ebook from https://ebookmeta.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookmeta.com
to discover even more!
Professional C and NET 2021st Edition Nagel
https://ebookmeta.com/product/professional-c-and-net-2021st-
edition-nagel/
Pro C# 7: With .NET and .NET Core - Eighth Edition
Andrew Troelsen
https://ebookmeta.com/product/pro-c-7-with-net-and-net-core-
eighth-edition-andrew-troelsen/
ASP NET Core Security 1st Edition Christian Wenz
https://ebookmeta.com/product/asp-net-core-security-1st-edition-
christian-wenz-2/
A History of Enterprise Policy: Government, Small
Business and Entrepreneurship 1st Edition Oliver
Mallett
https://ebookmeta.com/product/a-history-of-enterprise-policy-
government-small-business-and-entrepreneurship-1st-edition-
oliver-mallett/
Society and culture preliminary and HSC Kate Thompson
Emma Davidge Phil Webster Marshall Leaver Terence John
Lovat Nicole Martirena
https://ebookmeta.com/product/society-and-culture-preliminary-
and-hsc-kate-thompson-emma-davidge-phil-webster-marshall-leaver-
terence-john-lovat-nicole-martirena/
Lonely Planet Best of USA Travel Guide 3rd Edition
Lonely Planet
https://ebookmeta.com/product/lonely-planet-best-of-usa-travel-
guide-3rd-edition-lonely-planet/
Instaread Summaries The Alchemist Instaread
https://ebookmeta.com/product/instaread-summaries-the-alchemist-
instaread/
Unfuck Your Sleep The No 1 Non Negotiable Necessity for
Emotional and Physical Health 1st Edition Faith G.
Harper
https://ebookmeta.com/product/unfuck-your-sleep-the-no-1-non-
negotiable-necessity-for-emotional-and-physical-health-1st-
edition-faith-g-harper/
Gods (Forgotten Gods Reverse Harem #3) 1st Edition D.M.
Page
https://ebookmeta.com/product/gods-forgotten-gods-reverse-
harem-3-1st-edition-d-m-page/
Fodor s InFocus Charleston with Hilton Head and the
Lowcountry Full color Travel Guide 6th Edition Fodor'S
Travel Guides
https://ebookmeta.com/product/fodor-s-infocus-charleston-with-
hilton-head-and-the-lowcountry-full-color-travel-guide-6th-
edition-fodors-travel-guides/
Professional C and NET 2021st Edition Christian Nagel
Table of Contents
COVER
TITLE PAGE
INTRODUCTION
THE WORLD OF .NET
THE WORLD OF C#
WHAT'S NEW IN C#
WHAT'S NEW IN ASP.NET CORE
WHAT'S NEW WITH WINDOWS
WHAT YOU NEED TO WRITE AND RUN C# CODE
WHAT THIS BOOK COVERS
CONVENTIONS
SOURCE CODE
ERRATA
PART I: The C# Language
1 .NET Applications and Tools
FROM .NET FRAMEWORK TO .NET CORE TO .NET
.NET TERMS
.NET SUPPORT LENGTH
APPLICATION TYPES AND TECHNOLOGIES
DEVELOPER TOOLS
USING THE . NET CLI
SUMMARY
2 Core C#
FUNDAMENTALS OF C#
NULLABLE TYPES
USING PREDEFINED TYPES
CONTROLLING PROGRAM FLOW
ORGANIZATION WITH NAMESPACES
WORKING WITH STRINGS
COMMENTS
C# PREPROCESSOR DIRECTIVES
C# PROGRAMMING GUIDELINES
SUMMARY
3 Classes, Records, Structs, and Tuples
CREATING AND USING TYPES
PASS BY VALUE OR BY REFERENCE
CLASSES
RECORDS
STRUCTS
ENUM TYPES
REF, IN, AND OUT
TUPLES
VALUETUPLE
DECONSTRUCTION
PATTERN MATCHING
PARTIAL TYPES
SUMMARY
4 Object-Oriented Programming in C#
OBJECT ORIENTATION
INHERITANCE WITH CLASSES
MODIFIERS
INHERITANCE WITH RECORDS
USING INTERFACES
GENERICS
SUMMARY
5 Operators and Casts
OPERATORS
USING BINARY OPERATORS
TYPE SAFETY
OPERATOR OVERLOADING
COMPARING OBJECTS FOR EQUALITY
IMPLEMENTING CUSTOM INDEXERS
USER-DEFINED CONVERSIONS
SUMMARY
6 Arrays
MULTIPLE OBJECTS OF THE SAME TYPE
SIMPLE ARRAYS
MULTIDIMENSIONAL ARRAYS
JAGGED ARRAYS
ARRAY CLASS
ARRAYS AS PARAMETERS
ENUMERATORS
USING SPAN WITH ARRAYS
INDICES AND RANGES
ARRAY POOLS
BITARRAY
SUMMARY
7 Delegates, Lambdas, and Events
REFERENCING METHODS
DELEGATES
LAMBDA EXPRESSIONS
EVENTS
SUMMARY
8 Collections
OVERVIEW
COLLECTION INTERFACES AND TYPES
LISTS
STACKS
LINKED LISTS
SORTED LIST
DICTIONARIES
SETS
PERFORMANCE
IMMUTABLE COLLECTIONS
SUMMARY
9 Language Integrated Query
LINQ OVERVIEW
STANDARD QUERY OPERATORS
PARALLEL LINQ
EXPRESSION TREES
LINQ PROVIDERS
SUMMARY
10 Errors and Exceptions
HANDLING ERRORS
PREDEFINED EXCEPTION CLASSES
CATCHING EXCEPTIONS
USER-DEFINED EXCEPTION CLASSES
CALLER INFORMATION
SUMMARY
11 Tasks and Asynchronous Programming
WHY ASYNCHRONOUS PROGRAMMING IS
IMPORTANT
TASK-BASED ASYNC PATTERN
TASKS
ERROR HANDLING
CANCELLATION OF ASYNC METHODS
ASYNC STREAMS
ASYNC WITH WINDOWS APPS
SUMMARY
12 Reflection, Metadata, and Source Generators
INSPECTING CODE AT RUNTIME AND DYNAMIC
PROGRAMMING
CUSTOM ATTRIBUTES
USING REFLECTION
USING DYNAMIC LANGUAGE EXTENSIONS FOR
REFLECTION
EXPANDOOBJECT
SOURCE GENERATORS
SUMMARY
13 Managed and Unmanaged Memory
MEMORY
MEMORY MANAGEMENT UNDER THE HOOD
STRONG AND WEAK REFERENCES
WORKING WITH UNMANAGED RESOURCES
UNSAFE CODE
SPAN<T>
PLATFORM INVOKE
SUMMARY
PART II: Libraries
14 Libraries, Assemblies, Packages, and NuGet
THE HELL OF LIBRARIES
ASSEMBLIES
CREATING AND USING LIBRARIES
CREATING NUGET PACKAGES
MODULE INITIALIZERS
SUMMARY
15 Dependency Injection and Configuration
WHAT IS DEPENDENCY INJECTION?
USING THE .NET DI CONTAINER
USING THE HOST CLASS
LIFETIME OF SERVICES
INITIALIZATION OF SERVICES USING OPTIONS
USING CONFIGURATION FILES
CONFIGURATION WITH .NET APPLICATIONS
AZURE APP CONFIGURATION
SUMMARY
16 Diagnostics and Metrics
DIAGNOSTICS OVERVIEW
LOGGING
METRICS
ANALYTICS WITH VISUAL STUDIO APP CENTER
APPLICATION INSIGHTS
SUMMARY
17 Parallel Programming
OVERVIEW
PARALLEL CLASS
TASKS
CANCELLATION FRAMEWORK
CHANNELS
TIMERS
THREADING ISSUES
INTERLOCKED
MONITOR
SPINLOCK
WAITHANDLE
MUTEX
SEMAPHORE
EVENTS
BARRIER
READERWRITERLOCKSLIM
LOCKS WITH AWAIT
SUMMARY
18 Files and Streams
OVERVIEW
MANAGING THE FILE SYSTEM
ITERATING FILES
WORKING WITH STREAMS
USING READERS AND WRITERS
COMPRESSING FILES
WATCHING FILE CHANGES
JSON SERIALIZATION
USING FILES AND STREAMS WITH THE WINDOWS
RUNTIME
SUMMARY
19 Networking
OVERVIEW
WORKING WITH UTILITY CLASSES
USING SOCKETS
USING TCP CLASSES
USING UDP
USING WEB SERVERS
THE HTTPCLIENT CLASS
HTTPCLIENT FACTORY
SUMMARY
20 Security
ELEMENTS OF SECURITY
VERIFYING USER INFORMATION
ENCRYPTING DATA
ENSURING WEB SECURITY
SUMMARY
21 Entity Framework Core
INTRODUCING EF CORE
CREATING A MODEL
SCAFFOLDING A MODEL FROM THE DATABASE
MIGRATIONS
WORKING WITH QUERIES
LOADING RELATED DATA
WORKING WITH RELATIONSHIPS
SAVING DATA
CONFLICT HANDLING
USING TRANSACTIONS
USING AZURE COSMOS DB
SUMMARY
22 Localization
GLOBAL MARKETS
NAMESPACE SYSTEM.GLOBALIZATION
RESOURCES
LOCALIZATION WITH ASP.NET CORE
LOCALIZATION WITH WINUI
SUMMARY
23 Tests
OVERVIEW
UNIT TESTING
USING A MOCKING LIBRARY
ASP.NET CORE INTEGRATION TESTING
SUMMARY
PART III: Web Applications and Services
24 ASP.NET Core
UNDERSTANDING WEB TECHNOLOGIES
CREATING AN ASP.NET CORE WEB PROJECT
ADDING CLIENT-SIDE CONTENT
CREATING CUSTOM MIDDLEWARE
ENDPOINT ROUTING
REQUEST AND RESPONSE
SESSION STATE
HEALTH CHECKS
DEPLOYMENT
SUMMARY
25 Services
UNDERSTANDING TODAY'S SERVICES
REST SERVICES WITH ASP.NET CORE
CREATING A .NET CLIENT
USING EF CORE WITH SERVICES
AUTHENTICATION AND AUTHORIZATION WITH
AZURE AD B2C
IMPLEMENTING AND USING SERVICES WITH
GRPC
USING AZURE FUNCTIONS
MORE AZURE SERVICES
SUMMARY
26 Razor Pages and MVC
SETTING UP SERVICES FOR RAZOR PAGES AND
MVC
RAZOR PAGES
ASP.NET CORE MVC
SUMMARY
27 Blazor
BLAZOR SERVER AND BLAZOR WEBASSEMBLY
CREATING A BLAZOR SERVER WEB APPLICATION
BLAZOR WEBASSEMBLY
RAZOR COMPONENTS
SUMMARY
28 SignalR
OVERVIEW
CREATING A SIMPLE CHAT USING SIGNALR
GROUPING CONNECTIONS
STREAMING WITH SIGNALR
SUMMARY
PART IV: Apps
29 Windows Apps
INTRODUCING WINDOWS APPS
INTRODUCING XAML
WORKING WITH CONTROLS
WORKING WITH DATA BINDING
IMPLEMENTING NAVIGATION
IMPLEMENTING LAYOUT PANELS
SUMMARY
30 Patterns with XAML Apps
WHY MVVM?
DEFINING THE MVVM PATTERN
SAMPLE SOLUTION
MODELS
SERVICES
VIEW MODELS
VIEWS
MESSAGING USING EVENTS
SUMMARY
31 Styling Windows Apps
STYLING
SHAPES
GEOMETRY
TRANSFORMATION
BRUSHES
STYLES AND RESOURCES
TEMPLATES
ANIMATIONS
VISUAL STATE MANAGER
SUMMARY
INDEX
COPYRIGHT
DEDICATION
ABOUT THE AUTHOR
ABOUT THE TECHNICAL EDITOR
ACKNOWLEDGMENTS
END USER LICENSE AGREEMENT
List of Illustrations
Chapter 1
FIGURE 1-1
FIGURE 1-2
Chapter 5
FIGURE 5-1
Chapter 6
FIGURE 6-1
FIGURE 6-2
FIGURE 6-3
FIGURE 6-4
FIGURE 6-5
FIGURE 6-6
FIGURE 6-7
Chapter 8
FIGURE 8-1
FIGURE 8-2
FIGURE 8-3
FIGURE 8-4
Chapter 9
FIGURE 9-1
FIGURE 9-2
Chapter 13
FIGURE 13-1
FIGURE 13-2
FIGURE 13-3
FIGURE 13-4
FIGURE 13-5
FIGURE 13-6
Chapter 14
FIGURE 14-1
FIGURE 14-2
FIGURE 14-3
Chapter 16
FIGURE 16-1
FIGURE 16-2
FIGURE 16-3
FIGURE 16-4
FIGURE 16-5
Chapter 17
FIGURE 17-1
Chapter 18
FIGURE 18-1
Chapter 19
FIGURE 19-1
FIGURE 19-2
Chapter 20
FIGURE 20-1
Chapter 22
FIGURE 22-1
FIGURE 22-2
FIGURE 22-3
FIGURE 22-4
FIGURE 22-5
FIGURE 22-6
FIGURE 22-7
Chapter 23
FIGURE 23-1
Chapter 24
FIGURE 24-1
FIGURE 24-2
Chapter 25
FIGURE 25-1
FIGURE 25-2
FIGURE 25-3
FIGURE 25-4
FIGURE 25-5
FIGURE 25-6
Chapter 26
FIGURE 26-1
FIGURE 26-2
FIGURE 26-3
FIGURE 26-4
FIGURE 26-5
FIGURE 26-6
FIGURE 26-7
FIGURE 26-8
FIGURE 26-9
FIGURE 26-10
Chapter 27
FIGURE 27-1
FIGURE 27-2
FIGURE 27-3
FIGURE 27-4
FIGURE 27-5
Chapter 28
FIGURE 28-1
FIGURE 28-2
FIGURE 28-3
FIGURE 28-4
FIGURE 28-5
Chapter 29
FIGURE 29-1
FIGURE 29-2
FIGURE 29-3
FIGURE 29-4
FIGURE 29-5
FIGURE 29-6
FIGURE 29-7
FIGURE 29-8
FIGURE 29-9
FIGURE 29-10
FIGURE 29-11
FIGURE 29-12
FIGURE 29-13
FIGURE 29-14
FIGURE 29-15
FIGURE 29-16
FIGURE 29-17
FIGURE 29-18
FIGURE 29-19
FIGURE 29-20
Chapter 30
FIGURE 30-1
FIGURE 30-2
FIGURE 30-3
FIGURE 30-4
Chapter 31
FIGURE 31-1
FIGURE 31-2
FIGURE 31-3
FIGURE 31-4
FIGURE 31-5
FIGURE 31-6
FIGURE 31-7
FIGURE 31-8
FIGURE 31-9
FIGURE 31-10
FIGURE 31-11
FIGURE 31-12
FIGURE 31-13
FIGURE 31-14
PROFESSIONAL
C# and .NET
2021 Edition
Christian Nagel
INTRODUCTION
EVEN THOUGH .NET was announced in the year 2000, it is not
becoming a grandfather technology. Instead, .NET keeps increasing
developer traction since it has become open source and is available
not only on Windows but also on Linux platforms. .NET can also run
within the browser on the client—without the need to install a plugin
—by using the WebAssembly standard.
As new enhancements for C# and .NET are coming, a focus lies not
only on performance gains but also on ease of use. .NET more and
more is a choice for new developers.
C# is also attractive for long-term developers. Every year, Stack
Overflow asks developers about the most loved, dreaded, and wanted
programming languages and frameworks. For several years, C# has
been within the top 10 of the most loved programming languages.
ASP.NET Core now holds the top position as the most loved web
framework. .NET Core is number one in the most loved other
frameworks/libraries/tools category. See
https://insights.stackoverflow.com/survey/2020 for details.
When you use C# and ASP.NET Core, you can create web
applications and services (including microservices) that run on
Windows, Linux, and Mac. You can use the Windows Runtime to
create native Windows apps using C#, XAML, and .NET. You can
create libraries that you share between ASP.NET Core, Windows
apps, and .NET MAUI. You can also create traditional Windows
Forms and WPF applications.
Most of the samples of this book are built to run on a Windows or
Linux system. Exceptions are the Windows app samples that run
only on the Windows platform. You can use Visual Studio, Visual
Studio Code, or Visual Studio for the Mac as the developer
environment; only the Windows app samples require Visual Studio.
THE WORLD OF .NET
.NET has a long history; the first version was released in the year
2002. The new .NET generation with a complete rewrite of .NET
(.NET Core 1.0 in the year 2016) is very young. Recently, many
features from the old .NET version have been brought to .NET Core
to ease the migration experience.
When creating new applications, there is no reason not to move to
the new .NET versions. Whether old applications should stay with
the old version of .NET or be migrated to the new one depends on
the features used, how difficult the migration is, and what
advantages you gain after the application is migrated. The best
options here need to be considered with an application-by-
application analysis.
The new .NET provides easy ways to create Windows and web
applications and services. You can create microservices running in
Docker containers in a Kubernetes cluster; create web applications;
use the new OpenTelemetry standard to analyze distributed traces in
a vendor-independent manner; create web applications returning
HTML, JavaScript, and CSS; and create web applications returning
HTML, JavaScript, and .NET binaries that run in the client's browser
in a safe and standard way using WebAssembly. You can create
Windows applications in traditional ways using WPF and Windows
Forms and make use of modern XAML features and controls that
support the fluent design with WinUI and mobile applications with
.NET MAUI.
.NET uses modern patterns. Dependency injection is built into core
services, such as ASP.NET Core and EF Core, which not only makes
unit testing easier but also allows developers to easily enhance and
change features from these technologies.
.NET runs on multiple platforms. Besides Windows and macOS,
many Linux environments are supported, such as Alpine, CentOS,
Debian, Fedora, openSUSE, Red Hat, SLES, and Ubuntu.
.NET is open source (https://github.com/dotnet) and freely
available. You can find meeting notes for the C# compiler
(https://github.com/dotnet/csharplang), the source code for the C#
compiler (https://github.com/dotnet/Roslyn), the .NET runtime and
libraries (https://github.com/dotnet/runtime), and ASP.NET Core
(https://github.com/dotnet/aspnetcore) with Razor Pages, Blazor,
and SignalR.
Here's a summary of some of the features of the new .NET:
.NET is open source.
.NET uses modern patterns.
.NET supports development on multiple platforms.
ASP.NET Core can run on Windows and Linux.
THE WORLD OF C#
When C# was released in the year 2002, it was a language developed
for the .NET Framework. C# was designed with ideas from C++,
Java, and Pascal. Anders Hejlsberg had come to Microsoft from
Borland and brought experience from the language development of
Delphi. At Microsoft, Hejlsberg worked on Microsoft's version of
Java, named J++, before creating C#.
NOTE Today, Anders Hejlsberg has moved to TypeScript
(although he still influences C#), and Mads Torgersen is the
project lead for C#. C# improvements are discussed openly at
https://github.com/dotnet/csharplang, and you can read C#
language proposals and event meeting notes. You can also
submit your own proposals for C#.
C# started not only as an object-oriented general-purpose
programming language but was a component-based programming
language that supported properties, events, attributes (annotations),
and building assemblies (binaries including metadata).
Over time, C# was enhanced with generics, Language Integrated
Query (LINQ), lambda expressions, dynamic features, and easier
asynchronous programming. C# is not an easy programming
language because of the many features it offers, but it's continuously
evolving with features that are practical to use. With this, C# is more
than an object-oriented or component-based language; it also
includes ideas of functional programming—things that are of
practical use for a general-purpose language developing all kinds of
applications.
Nowadays, a new version of C# is released every year. C# 8 added
nullable reference types, and C# 9 added records and more. C# 10 is
releasing with .NET 6 in 2021 and C# 11 will be released with .NET 7
in 2022. Because of the frequency of changes nowadays, check the
GitHub repository for the book (read more in the section “Source
Code”) for continuous updates.
WHAT'S NEW IN C#
Every year, a new version of C# is released, with many new features
available in each version. The latest versions include features such as
nullable reference types to reduce exceptions of type
NullableReferenceException and instead let the compiler help more;
features to increase productivity such as indices and ranges; switch
expressions that make the switch statement look old; features for
using declarations; and enhancements with pattern matching. Top-
level statements allow reducing the number of source code lines with
small applications and records—classes where the compiler creates
boilerplate code for equality comparison, deconstruction, and with
expressions. Code generators allow creating code automatically while
the compiler runs. All these new features are covered in this book.
WHAT'S NEW IN ASP.NET CORE
ASP.NET Core now contains new technology for creating web
applications: Blazor Server and Blazor WebAssembly. With Blazor,
you have a full-stack option to write C# code both for the client and
for the server. With Blazor Server, the Razor components you create
containing HTML and C# code run on the server. With Blazor
WebAssembly, Razor components written with C# and HTML run on
the client using the HTML 5 standard WebAssembly that allows you
to run binary code in the browser, which is supported by all modern
web browsers.
For creating services, you can now use gRPC with ASP.NET Core for
binary communication between services. This is a great option for
service-to-service communication to reduce the bandwidth needed,
as well as CPU and memory usage if a lot of data transfer is needed.
WHAT'S NEW WITH WINDOWS
For developing applications for Windows, a new technology
combines the features of the Universal Windows Platform and
desktop applications: WinUI 3. WinUI is the native UI platform for
Windows 10 applications. With WinUI 3, you can use modern XAML
code that includes compiled binding to create desktop applications.
New controls with Microsoft's fluent design system are available.
These controls are not delivered with the Windows Runtime as was
previously the case with the Universal Windows Platform (UWP).
These controls are developed independently of the Windows 10
version that allows you to use the newest controls with Windows 10
versions 1809 and above. As the roadmap available with WinUI
shows, these new controls will be usable from WPF applications as
well.
WHAT YOU NEED TO WRITE AND RUN C#
CODE
.NET runs on Windows, Linux, and Mac operating systems. You can
create and build your programs on any of these operating systems
using Visual Studio Code (https://code.visualstudio.com). You can
build and run most of the samples on Windows or Linux and use the
.NET development tools of your choice. Only the WinUI applications
require you to use the Windows platform, and here, Visual Studio is
the best option to use. The minimum version required to build and
run the WinUI application is version 16.10.
The command line plays an important part when using the .NET CLI
and the Azure CLI; you can use the new Windows Terminal. With the
newest Windows 10 versions, this terminal is delivered as part of
Windows. With older versions, you can download it from the
Microsoft Store.
Most .NET developers use the Windows platform as their
development machine. When using the Windows Subsystem for
Linux (WSL 2), you can build and run your .NET applications in a
Linux environment, and you can install different Linux distributions
from your Windows environment and access the same files. Visual
Studio even allows debugging your .NET applications while they run
in a Linux environment on WSL 2.
With some samples of the book, Microsoft Azure is shown as an
optional hosting environment to run your web applications, use
Azure Functions, and use Entity Framework Core to access SQL
Server and Azure Cosmos DB. For this, you can use a free trial
offering from Microsoft Azure; visit
https://azure.microsoft.com/free to register.
WHAT THIS BOOK COVERS
This book covers these four major parts:
The C# language
Using base class libraries from .NET
Developing web applications and services
Developing Windows applications
Let's get into the different parts and all the chapters in more detail.
Part I, “The C# Language”
The first part of this book covers all the aspects of the C#
programming language. You learn the syntax options and see how
the C# syntax integrates with classes and interfaces from .NET. This
part gives good grounding in the C# language. This section doesn't
presume knowledge of any particular programming language, but it's
assumed you are an experienced programmer. You start looking at
C#'s basic syntax and data types before getting into advanced C#
features.
Chapter 1, “.NET Applications and Tools,” covers what you need
to know to create .NET applications. You learn about the .NET
CLI and create a Hello World application using C# 9 top-level
statements.
Chapter 2, “Core C#,” dives into core C# features and gives you
details on top-level statements and information on declaration
of variables and data types. The chapter covers target-typed new
expressions, explains nullable reference types, and defines a
program flow that includes the new switch expressions.
Chapter 3, “Classes, Records, Structs, and Tuples,” gives you
information to create reference or value types, create and use
tuples, and make use of the C# 9 enhancement to create and use
records.
Chapter 4, “Object-Oriented Programming in C#,” goes into
details of object-oriented techniques with C# and demonstrates
all the C# keywords for object orientation. It also covers using
inheritance with C# 9 records.
Chapter 5, “Operators and Casts,” explains the C# operators,
and you also learn how to overload standard operators for
custom types.
Chapter 6, “Arrays,” doesn't stop with simple arrays; you learn
using multidimensional and jagged arrays, use the Span type to
access arrays, and use the new index and range operators to
access arrays.
Chapter 7, “Delegates, Lambdas, and Events,” covers .NET
pointers to methods, lambda expressions with closures, and
.NET events.
Chapter 8, “Collections,” dives into the different kind of
collections, such as lists, queues, stacks, dictionaries, and
immutable collections. The chapter also gives you the
information you need to decide which collection to use in what
scenario.
Chapter 9, “Language Integrated Query,” gives you the C#
language integrated query features to query data from your
collections. You also learn how to use multiple CPU cores with a
query and what's behind expression trees that are used when
you use LINQ to access your database with Entity Framework
Core.
Chapter 10, “Errors and Exceptions,” covers how you should
deal with errors, throw and catch exceptions, and filter
exceptions when catching them.
Chapter 11, “Tasks and Asynchronous Programming,” shows the
C# keywords async and await in action— not only with the task-
based async pattern but also with async streams, which is a new
feature since C# 8.
Chapter 12, “Reflection, Metadata, and Source Generators,”
covers using and reading attributes with C#. The attributes will
not just be read using reflection, but you'll also see the
functionality of source generators that allow creating source
code during compile time.
Chapter 13, “Managed and Unmanaged Memory,” is the last
chapter of Part I, which not only shows using the IDisposable
interface with the using statement and the new using declaration
but also demonstrates using the Span type with managed and
unmanaged memory. You can read about using Platform Invoke
both with Windows and with Linux environments.
Part II, “Libraries”
Part II starts with creating custom libraries and NuGet packages, but
the major topics covered with Part II are for using .NET libraries that
are important for all application types.
Chapter 14, “Libraries, Assemblies, Packages, and NuGet,”
explains the differences between assemblies and NuGet
packages. In this chapter, you learn how to create NuGet
packages and are introduced to a new C# feature, module
initializers, which allow you to run initial code in a library.
Chapter 15, “Dependency Injection and Configuration,” gives
detail about how the Host class is used to configure a
dependency injection container and the built-in options to
retrieve configuration information from a .NET application with
different configuration providers, including Azure App
Configuration and user secrets.
Chapter 16, “Diagnostics and Metrics,” continues using the Host
class to configure logging options. You also learn about reading
metric information that's offered from some NET providers,
using Visual Studio App Center, and extending logging for
distributed tracing with OpenTelemetry.
Chapter 17, “Parallel Programming,” covers myriad features
available with .NET for parallelization and synchronization.
Chapter 11 shows the core functionality of the Task class. In
Chapter 17, more of the Task class is shown, such as forming task
hierarchies and using value tasks. The chapter goes into issues
of parallel programming such as race conditions and deadlocks,
and for synchronization, you learn about different features
available with the lock keyword, the Monitor, SpinLock, Mutex,
Semaphore classes, and more.
Chapter 18, “Files and Streams,” not only covers reading and
writing from the file system with new stream APIs that allow
using the Span type but also covers the new .NET JSON serializer
with classes in the System.Text.Json namespace.
In Chapter 19, “Networking,” you learn about foundational
classes for network programming, such as the Socket class and
how to create applications using TCP and UDP. You also use the
HttpClient factory pattern to create HttpClient objects with
automatic retries if transient errors occur.
Chapter 20, “Security,” gives you information about
cryptography classes for encrypting data, explains how to use
the new Microsoft.Identity platform for user authentication,
and provides information on web security and what you need to
be aware of with encoding issues as well as cross-site request
forgery attacks.
Chapter 21, “Entity Framework Core,” covers reading and
writing data from a database—including the many features
offered from EF Core, such as shadow properties, global query
filters, many-to-many relations, and what metric information is
now offered by EF Core—and reading and writing to Azure
Cosmos DB with EF Core.
In Chapter 22, “Localization,” you learn to localize applications
using techniques that are important both for Windows and web
applications.
Chapter 23, “Tests,” covers creating unit tests, analyzing code
coverage with the .NET CLI, using a mocking library when
creating unit tests, and what features are offered by ASP.NET
Core to create integration tests.
Part III, “Web Applications and Services”
Part III of this book is dedicated to ASP.NET Core technologies for
creating web applications and services, no matter whether you run
these applications and services in your on-premises environment or
in the cloud making use of Azure App Services, Azure Static Web
Apps, or Azure Functions.
Chapter 24, “ASP.NET Core,” gives you the foundation of
ASP.NET Core. Based on the dependency injection container
you learned about in Part II, this chapter shows how ASP.NET
Core makes use of middleware to add functionality to every
HTTP request and define routes with ASP.NET Core endpoint
routing.
Chapter 25, “Services,” dives into creating microservices using
different technologies such as ASP.NET Core as well as using
Azure Functions and gRPC for binary communication.
Chapter 26, “Razor Pages and MVC,” is about interacting with
users with ASP.NET Core technologies. It covers Razor pages,
Razor views, and functionality such as tag helpers and view
components.
Chapter 27, “Blazor,” is about the newest enhancement of
ASP.NET Core with Razor components, which allows you to
implement C# code running either on the server or in the client
using WebAssembly. You learn about the differences between
Blazor Server and Blazor WebAssembly, what the restrictions
are with these technologies, and the built-in components
available.
Chapter 28, “SignalR,” covers the real-time functionality
available with ASP.NET Core to send information to a group of
clients and how you can use C# async streams with SignalR.
Part IV, “Apps”
Part IV of this book is dedicated to XAML code and creating
Windows applications with the native UI platform for Windows 10:
WinUI. Much of the information you get here can also be applied to
WPF applications and to .NET MAUI and developing XAML-based
applications for mobile platforms.
Chapter 29, “Windows Apps,” gives you foundational
information on XAML, including dependency properties and
attached properties. You learn how to create custom markup
extensions and about the control categories available with
WinUI, including advanced techniques such as adaptive triggers
and deferred loading.
Chapter 30, “Patterns with XAML Apps,” gives you the
information you need to use the MVVM pattern and how you
can share as much code as possible between different XAML-
based technologies such as WinUI, WPF, and .NET MAUI.
Chapter 31, “Styling Windows Apps,” explains XAML shapes and
geometry elements, dives into styles and control templates, gives
you information on creating animations, and explains how you
can use the Visual State Manager with your XAML-based
applications.
CONVENTIONS
To help you get the most from the text and keep track of what's
happening, I use some conventions throughout the book.
WARNING Warnings hold important, not-to-be-forgotten
information that is directly relevant to the surrounding text.
NOTE Notes indicate notes, tips, hints, tricks, and/or asides to
the current discussion.
As for styles in the text:
We highlight new terms and important words when we
introduce them.
We show keyboard strokes like this: Ctrl+A.
We show filenames, URLs, and code within the text like so:
persistence.properties.
We present code in two different ways:
We use a monofont type with no highlighting for most code
examples.
We use bold to emphasize code that's particularly important
in the present context or to show changes from a previous
code snippet.
SOURCE CODE
As you work through the examples in this book, you may choose
either to type all the code manually or to use the source code files
that accompany the book. All the source code used in this book is
available for download at www.wiley.com. When at the site, simply
locate the book's title (either by using the Search box or by using one
of the title lists) and click the Download Code link on the book's
detail page to obtain all the source code for the book.
NOTE Because many books have similar titles, you may find it
easiest to search by ISBN; this book's ISBN is 978-1-119-79720-3.
After you download the code, just decompress it with your favorite
compression tool.
The source code is also available on GitHub at
https://www.github.com/ProfessionalCSharp/ProfessionalCSharp202
1. With GitHub, you can also open each source code file with a web
browser. When you use the website, you can download the complete
source code in a zip file. You can also clone the source code to a local
directory on your system. Just install the Git tools, which you can do
with Visual Studio or by downloading the Git tools from
https://git-scm.com/downloads for Windows, Linux, and Mac. To
clone the source code to a local directory, use git clone:
> git clone
https://www.github.com/ProfessionalCSharp/ProfessionalCSharp
2021
With this command, the complete source code is copied to the
subdirectory ProfessionalCSharp2021. From there, you can start
working with the source files.
As updates of .NET become available (until the next edition of the
book will be released), the source code will be updated on GitHub.
Check the readme.md file in the GitHub repo for updates. If the source
code changes after you cloned it, you can pull the latest changes after
changing your current directory to the directory of the source code:
> git pull
In case you've made some changes on the source code, git pull
might result in an error. If this happens, you can stash away your
changes and pull again:
> git stash
> git pull
The complete list of git commands is available at https://git-
scm.com/docs.
In case you have questions on the source code, use discussions with
the GitHub repository. If you find an error with the source code,
create an issue. Open
https://github.com/ProfessionalCSharp/ProfessionalCSharp2021 in
the browser, click the Issues tab, and click the New Issue button.
This opens an editor. Just be as descriptive as possible to describe
your issue.
For reporting issues, you need a GitHub account. If you have a
GitHub account, you can also fork the source code repository to your
account. For more information on using GitHub, check
https://guides.github.com/activities/hello-world.
NOTE You can read the source code and issues and clone the
repository locally without joining GitHub. For posting issues
and creating your own repositories on GitHub, you need your
own GitHub account. For basic functionality, GitHub is free (see
https://github.com/pricing).
ERRATA
We make every effort to ensure that there are no errors in the text or
in the code. However, no one is perfect, and mistakes do occur. If you
find an error in one of our books, like a spelling mistake or faulty
piece of code, we would be grateful for your feedback. By sending in
errata, you may save another reader hours of frustration, and at the
same time you can help provide even higher-quality information.
To find the errata page for this book, go to www.wiley.com and locate
the title using the Search box or one of the title lists. Then, on the
book details page, click the Book Errata link. On this page, you can
view all errata that have been submitted for this book and posted by
the book's editors.
If you don't spot “your” error on the Book Errata page, go to
https://support.wiley.com/s/article/reporting-a-wiley-book-
error for information about how to send us the error you have found.
We'll check the information and, if appropriate, post a message to
the book's errata page and fix the problem in subsequent editions of
the book.
PART I
The C# Language
CHAPTER 1: .NET Applications and Tools
CHAPTER 2: Core C#
CHAPTER 3: Classes, Records, Structs, and Tuples
CHAPTER 4: Object-Oriented Programming in C#
CHAPTER 5: Operators and Casts
CHAPTER 6: Arrays
CHAPTER 7: Delegates, Lambdas, and Events
CHAPTER 8: Collections
CHAPTER 9: Language Integrated Query
CHAPTER 10: Errors and Exceptions
CHAPTER 11: Tasks and Asynchronous Programming
CHAPTER 12: Reflection, Metadata, and Source Generators
CHAPTER 13: Managed and Unmanaged Memory
1
.NET Applications and Tools
WHAT'S IN THIS CHAPTER?
From .NET Framework to .NET Core to .NET
.NET terms
.NET support length
Application types and technologies
Developer tools
Using the .NET command-line interface
Programming “Hello World!”
Technologies for creating web apps
CODE DOWNLOADS FOR THIS CHAPTER
The source code for this chapter is available on the book page at
www.wiley.com. Click the Downloads link. The code can also be found at
https://github.com/ProfessionalCSharp/ProfessionalCSharp2021 in the
directory 1_CS/HelloWorld.
The code for this chapter is divided into the following major examples:
HelloWorld
WebApp
SelfContainedHelloWorld
FROM .NET FRAMEWORK TO .NET CORE TO .NET
The first version of .NET was released in 2002. Since the first version, many
things have changed. The first era of .NET was the .NET Framework that
offered Windows Forms for Windows desktop development and Web Forms
to create web applications. This version of .NET was available only for
Microsoft Windows. At that time, Microsoft also invented a standard for C#
at ECMA (https://www.ecma-
international.org/publications/standards/Ecma-334.htm).
Later, Silverlight used a subset of this technology with a limited library and
runtime running in browsers using a browser add-in. At that time, the
company Ximian developed the Mono runtime. This runtime was available
for Linux and Android and offered a subset of Microsoft .NET’s
functionality. Later, Novell bought Ximian, and Novell was later bought by
The Attachmate Group. As the new organization lost interest in .NET,
Miguel de Icaza (the founder of Ximian) started Xamarin and took the
interesting .NET parts into his new organization to start .NET for Android
and iOS. Nowadays, Xamarin belongs to Microsoft, and the Mono runtime
is part of the dotnet runtime repo (https://github.com/dotnet/runtime).
Silverlight started .NET development for other devices with different form
factors, which have different needs for .NET. Silverlight was not successful
in the long term because HTML5 offered features that previously only were
available by using browser add-ins. However, Silverlight started moving
.NET in other directions that resulted in .NET Core.
.NET Core was the biggest change to .NET since its inception. .NET code
became open-source, you could create apps for other platforms, and the
new code base of .NET is using modern design patterns. The next step is a
logical move: the version of .NET after .NET Core 3.1 is .NET 5. The Core
name is removed, and version 4 was skipped to send a message to .NET
Framework developers that there's a higher version than .NET Framework
4.8, and it's time to move to .NET 5 for creating new applications.
For developers using .NET Core, the move is an easy one. With existing
applications, usually all that needs to be changed is the version number of
the target framework. Moving applications from the .NET Framework is not
that easy and might require bigger changes. Depending on the application
type, more or less change is needed. .NET Core 3.x supports WPF and
Windows Forms applications. With these application types, the change can
be easy. However, existing .NET Framework WPF applications may have
features that cannot be moved that easily to the new .NET. For example,
application domains are not supported with .NET Core and .NET 5. Moving
Windows Communication Foundation (WCF) services to .NET 5 is not at all
easy. The server part of WCF is not supported in the new .NET era. The
WCF part of the application needs to be rewritten to ASP.NET Core Web
API, gRPC, or another communication technology that fulfills the needs.
With existing applications, it can be useful to stay with the .NET
Framework instead of changing to the new .NET because the old framework
will still be maintained for many years to come. The .NET Framework is
installed with Windows 10, and support for the .NET Framework has a long
target that is bound to the support of the Windows 10 versions.
The new .NET and NuGet packages allow Microsoft to provide faster update
cycles for delivering new features. It's not easy to decide what technology
should be used for creating applications. This chapter helps you with that
decision. It gives you information about the different technologies available
for creating Windows and web apps and services, offers guidance on what to
choose for database access, and helps with moving from old technologies to
new ones. You'll also read about the .NET tooling that you can use with the
code samples through all the chapters of this book.
.NET TERMS
Before digging deeper, you should understand concepts and some
important .NET terms, such as what's in the .NET SDK and what the .NET
runtime is. You also should get a better understanding of the .NET
Framework and .NET, when to use the .NET Standard, and the NuGet
packages and .NET namespaces.
.NET SDK
For developing .NET applications, you need to install the .NET SDK. The
SDK contains the .NET command-line interface (CLI), tools, libraries, and
the runtime. With the .NET CLI, you can create new applications based on
templates, restore packages, build and test the application, and create
deployment packages. Later in this chapter in the section “.NET CLI,” you
will see how to create and build applications.
If you use Visual Studio 2019, the .NET SDK is installed as part of Visual
Studio. If you don't have Visual Studio, you can install the SDK from
https://dot.net. Here, you can find instructions on how to install the SDK
on Windows, Mac, and Linux systems.
You can install multiple versions of the .NET SDK in parallel. The command
> dotnet --list-sdks
shows all the different SDK versions that are installed on the system. By
default, the latest version is used.
NOTE To run the command, you have many different options to
start a command prompt. One is the Windows built-in Command
Prompt; you can install the new Windows Terminal; if Visual Studio is
installed, you can start the Developer Command Prompt; or you can
use the bash shell. Read more on the Windows Terminal later in this
chapter in the section “Developer Tools.”
You can create a global.json file if you do not want to use the latest version
of the SDK. The command
> dotnet new globaljson
creates the file global.json in the current directory. This file contains the
version element with the version number currently used. You can change
the version number to one of the other SDK versions that is installed:
{
"sdk": {
"version": "5.0.202"
}
}
In the directory of global.json and its subdirectories, the specified SDK
version is used. You can verify this with
> dotnet --version
.NET Runtime
On the target system, the .NET SDK is not required. Here you just need to
install the .NET runtime. The runtime includes all the core libraries and the
dotnet driver.
The dotnet driver is used to run the application—for example, the Hello,
World application with
> dotnet hello-world.dll
At https://dot.net, you can find not only instructions to download and
install the SDK on different platforms but also the runtime.
Instead of installing the runtime on the target system, you also can deliver
the runtime as part of the application (which is known as self-contained
deployment). This technique is very different from older .NET Framework
applications and is covered later in the chapter in the “Using the .NET CLI”
section.
To see which runtimes are installed, you can use
> dotnet --list-runtimes
Common Language Runtime
The C# compiler compiles C# code to Microsoft Intermediate Language (IL)
code. This code is a little bit like assembly code, but it has more object-
oriented features. The IL code is run by the Common Language Runtime
(CLR). What's done by a CLR?
The IL code is compiled to native code by the CLR. The IL code available in
.NET assemblies is compiled by a Just-In-Time (JIT) compiler. This
compiler creates platform-specific native code. The runtime includes a JIT
compiler named RyuJIT. This compiler is not only faster than the previous
one, but it also has better support for using Edit & Continue while you're
debugging the application with Visual Studio.
The runtime also includes a type system with a type loader that is
responsible for loading types from assemblies. Security infrastructure with
the type system verifies whether certain type system structures are
permitted—for example, with inheritance.
After instances of types are created, they also need to be destroyed, and
memory needs to be recycled. Another feature of the runtime is the garbage
collector. The garbage collector cleans up memory from objects that are no
longer referenced in the managed heap.
The runtime is also responsible for threading. When you are creating a
managed thread from C#, it is not necessarily a thread from the underlying
operating system. Threads are virtualized and managed by the runtime.
NOTE How you can create and manage threads from C# is covered
in Chapter 17, “Parallel Programming.” Chapter 13, “Managed and
Unmanaged Memory,” gives information about the garbage collector
and how to clean up memory.
.NET Compiler Platform
The C# compiler that's installed as part of the SDK belongs to the .NET
Compiler Platform, which is also known by the code name Roslyn. Roslyn
allows you to interact with the compilation process, work with syntax trees,
and access the semantic model that is defined by language rules. You can
use Roslyn to write code analyzers and refactoring features. You also can
use Roslyn with a new feature of C# 9, code generators, which are discussed
in Chapter 12, “Reflection, Metadata, and Source Generators.”
.NET Framework
The .NET Framework is the name of the old .NET. The last version available
is .NET Framework 4.8. It's not that useful to create new applications with
this framework, but of course you can maintain existing applications
because this technology will still be supported for many years to come. If
existing applications don't get any advantages by moving to new
technologies and there's not a lot of maintenance going on, there's no need
to switch in the short term.
Depending on the technologies used with existing applications, the switch
to .NET can be easy. WPF and Windows Forms have been offered with
newer technologies since .NET Core 3. However, WPF and Windows
applications could have used features where the application architecture
might need a change.
Examples of technologies that are no longer offered with new versions of
.NET are ASP.NET Web Forms, Windows Communication Foundation
(WCF), and Windows Workflow Foundation (WF). Instead of ASP.NET
Web Forms, you can rewrite applications using ASP.NET Blazor. Instead of
WCF, you can use ASP.NET Core Web API or gRPC. Instead of WF, moving
to Azure Logic Apps might be useful.
.NET Core
.NET Core is the new .NET that is used by all new technologies and is a
main focus of this book (with the new name .NET). This framework is open
source, and you can find it at http://www.github.com/dotnet. The runtime is
the CoreCLR repository; the framework containing collection classes, file
system access, console, XML, and a lot more is in the CoreFX repository.
Unlike the .NET Framework, where the specific version you needed for the
application had to be installed on the system, with .NET Core 1.0, the
framework, including the runtime, is delivered with the application.
Previously, there were times when you might have had problems deploying
an ASP.NET web application to a shared server because the provider had
older versions of .NET installed; those times are gone. Now you can deliver
the runtime with the application, and you are not dependent on the version
installed on the server.
.NET Core is designed in a modular approach. The framework is split into a
large list of NuGet packages. So that you don't have to deal with all the
packages, metapackages reference the smaller packages that work together.
This even improved with .NET Core 2.0 and ASP.NET Core 2.0. With
ASP.NET Core 2.0, you just need to reference Microsoft.AspNetCore.All to
get all the packages you typically need with ASP.NET Core web
applications.
.NET Core can be updated at a fast pace. Even updating the runtime doesn't
influence existing applications because the runtime can be installed with
the applications. Now Microsoft can improve .NET Core, including the
runtime, with faster release cycles.
NOTE For developing apps using .NET Core, Microsoft created new
command-line utilities. These tools are introduced later in this chapter
through a “Hello World!” application in the section “Using the .NET
CLI.”
.NET
Starting with .NET 5, .NET Core has a new name: .NET. Removing “Core”
from the name should tell developers who still use the .NET Framework
that there's not a new version of the .NET Framework from now on. The
.NET Framework is no longer receiving new features. For new applications,
you should use .NET.
.NET Standard
.NET Standard is an important specification when creating and using
libraries. .NET Standard offers a contract rather than an implementation.
With this contract, available APIs are listed. With every new version of
.NET Standard, new APIs are added. APIs are never removed. For example,
.NET Standard 2.1 lists more APIs than .NET Standard 1.6.
When you're creating a library, you probably want to use as many APIs as
possible, so I suggest you choose the most recent .NET Standard version.
However, the highest standard version also means the lowest number of
platforms that support this standard, so you may need to take that into
consideration.
A table at https://docs.microsoft.com/dotnet/standard/net-standard gives
you the details on what platform supports which version of the standard.
For example, .NET Framework 4.6.1 and later support up to .NET Standard
2.0. In addition, .NET Core 3.0 and later (which includes .NET 5 and later)
support .NET Standard 2.1. The Universal Windows Platform build
10.0.16299 supports .NET Standard 2.0. Xamarin.Android 10.0 supports
.NET Standard 2.1.
As of .NET 5, the .NET Standard becomes irrelevant. If you're creating
libraries with .NET 5, you can use libraries from .NET 5, .NET 6, and later
applications. Similarly, when you're creating libraries with .NET 7, you can
use libraries from applications written with .NET 7 and later.
However, we can't expect that the .NET Framework, Mono, and other older
technologies will just fade away, so .NET Standard will still be needed for
many years to come. If you need to support older technologies with your
libraries, you'll still need .NET Standard.
NOTE Read detailed information about .NET Standard in Chapter
14, “Libraries, Assemblies, Packages, and NuGet.”
NuGet Packages
In the early days, assemblies were reusable units with applications. That use
is still possible (and necessary with some assemblies) when you're adding a
reference to an assembly for using the public types and methods from your
own code. However, using libraries can mean a lot more than just adding a
reference and using it. Using libraries can also mean making some
configuration changes or using scripts to take advantage of some features.
The target framework determines which binaries you can use. These are
reasons to package assemblies within NuGet packages, which are zip files
that contain the assembly (or multiple assemblies) as well as configuration
information and PowerShell scripts.
Another reason for using NuGet packages is that they can be found easily;
they're available not only from Microsoft but also from third parties. NuGet
packages are easily accessible on the NuGet server at
https://www.nuget.org.
You can add NuGet packages to applications with the .NET CLI:
> dotnet add package <package-name>
From the references within a Visual Studio project, you can open the NuGet
Package Manager (see Figure 1-1). There you can search for packages and
add them to the application. This tool enables you to search for packages
that are not yet released (including prerelease options) and define the
NuGet server that should be searched for packages. One place to search for
packages can be your own shared directory where you've placed your
internal packages that you've used.
FIGURE 1-1
Namespaces
The classes available with .NET are organized in namespaces. Most of these
namespaces start with the name System or Microsoft. The following table
describes a few of the namespaces to give you an idea about the hierarchy:
NAMESPACE DESCRIPTION
System.Collections This is the root namespace for
collections. Collections are also
found within subnamespaces
such as
System.Collections.Concurrent
and
System.Collections.Generic.
System.Diagnostics This is the root namespace for
diagnostics information, such
as event logging and tracing (in
the namespace
System.Diagnostics.Tracing).
NAMESPACE DESCRIPTION
System.Globalization This is the namespace that
contains classes for
globalization and localization
of applications.
System.IO This is the namespace for File
input/output (I/O), which
includes classes that access
files and directories. Readers,
writers, and streams are here.
System.Net This is the namespace for core
networking, such as accessing
DNS servers and creating
sockets with
System.Net.Sockets.
System.Threading This is the root namespace for
threads and tasks. Tasks are
defined within
System.Threading.Tasks.
Microsoft.Data This is the namespace for
accessing databases.
Microsoft.Data.SqlClient
contains classes that access the
SQL Server. The previous
classes from System.Data have
been repackaged into
Microsoft.Data.
Microsoft.Extensions.DependencyInjection This is the namespace for the
Microsoft DI container that is
part of .NET.
Microsoft.EntityFrameworkCore To access relational and
NoSQL databases, Entity
Framework Core can be used.
Types are defined in this
namespace.
.NET SUPPORT LENGTH
When you're working in the new era of .NET, you should know about
versions with different support cycles. .NET releases differ based on a
Current or Long-Term Support LTS moniker. LTS versions are supported at
least three years, or for one year after the next LTS version is available. If
for example, the next LTS version is available 2.5 years after the previous
one was released, and the previous one has a support length of 3.5 years.
Current versions are supported for only three months after the next version
is available. At the time of this writing, .NET Core 2.2 and 3.0 are current
versions that are already no longer supported with security and hot fixes,
whereas .NET Core 2.1 and 3.1 are LTS versions that still have support. The
following table lists the .NET Core and .NET versions with their release
dates, support level, and end-of-life dates:
.NET
CORE/.NET
VERSION
RELEASE
DATE
SUPPORT
LEVEL
END OF LIFE
1.0 June 27,
2016
LTS June 27, 2019
1.1 Nov. 16, 2016 LTS* June 27, 2019
2.0 Aug. 14, 2017 Current Oct. 1, 2018
2.1 May 30, 2018 LTS Aug. 21, 2021
2.2 Dec. 4, 2018 Current Dec. 23, 2019
3.0 Sep. 23, 2019 Current Mar. 3, 2020
3.1 Dec. 3, 2019 LTS Dec. 3, 2022
5.0 Nov. 10,
2020
Current around Feb. 2022
6.0 Nov. 2021 LTS Nov. 2024
7.0 Nov. 2022 Current Feb. 2024 or earlier in
case minor versions are
released
8.0 Nov. 2023 LTS Nov. 2026
Starting with .NET 5, the versions become more predictable. Every year in
November, a new major release is available. Every second year, the release
is an LTS version.
Depending on the environment you're working in, you might decide to use
LTS or Current versions. With current versions, you get new features faster,
but you need to upgrade to newer versions more often. While the
application is in its active development stage, you might decide to use the
current version. As your application is becoming more stable, you can
switch to the next LTS version.
Random documents with unrelated
content Scribd suggests to you:
Professional C and NET 2021st Edition Christian Nagel
Professional C and NET 2021st Edition Christian Nagel
Professional C and NET 2021st Edition Christian Nagel
The Project Gutenberg eBook of The Auk: A
Quarterly Journal of Ornithology, Vol. XXXVI
APRIL, 1919 No. 2
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.
Title: The Auk: A Quarterly Journal of Ornithology, Vol. XXXVI
APRIL, 1919 No. 2
Author: Various
Editor: Witmer Stone
Release date: April 2, 2019 [eBook #59190]
Language: English
Credits: Produced by Paul Marshall and the Online Distributed
Proofreading Team at http://www.pgdp.net (This file
was
produced from images generously made available by
The
Internet Archive)
*** START OF THE PROJECT GUTENBERG EBOOK THE AUK: A
QUARTERLY JOURNAL OF ORNITHOLOGY, VOL. XXXVI APRIL, 1919
NO. 2 ***
Professional C and NET 2021st Edition Christian Nagel
Old ┐ CONTINUATION OF THE ┌ New
Series, ├ BULLETIN OF THE ┤ Series,
Vol.
XLIV
┘
NUTTALL ORNITHOLOGICAL
CLUB
└
Vol.
XXXVI
The Auk
A Quarterly Journal of Ornithology
Vol. XXXVI APRIL, 1919 No. 2
PUBLISHED BY
The American Ornithologists’ Union
CAMBRIDGE, MASS.
Entered as second-class mail matter in the Post Office at Boston, Mass.
“Acceptance for mailing at special rate of postage provided for in
Section 1103, Act of October 3, 1917, authorized on September 23, 1918.”
CONTENTS
PAGE
Mrs. Olive Thorne Miller.
By Florence
Merriam Bailey.
(Plate
VII.)
163
An Experience with Horned Grebes
(Colymbus auritus).
By Alexander D.
DuBois.
(Plates
VIII-X.)
170
Historical Notes on Harris’s Sparrow
(Zonotrichia querula).
By Harry Harris 180
Notes on the Structure of the Palate
in Icteridæ.
By Alexander
Wetmore
190
The Crow in Colorado. By W. H. Bergtold 198
Winter Robins in Nova Scotia.
By Harrison F.
Lewis
205
Remarks on Beebe’s ‘Tropical Wild
Life.’
By Thomas E.
Penard
217
Problems Suggested by Nests of
Warblers of the
Genus Dendroica.
By John Treadwell
Nichols
225
On the Popular Names of Birds.
By Ernest
Thompson Seton
229
The Reality of Species.
By Leverett Mills
Loomis
235
Geographical Variation in the Black-
throated Loons.
By A. C. Bent 238
Reasons for Discarding a Proposed
Race of the
Glaucous Gull (Larus
hyperboreus).
By Jonathan
Dwight, M. D.
242
The Birds of the Red Deer River,
Alberta.
By P. A. Taverner 248
Fourth Annual List of Proposed
Changes in the A. O. U.
By Harry C.
Oberholser
266
Check-List of North American
Birds.
New Forms of South American Birds
and Proposed
New Subgenera.
By Charles B. Cory 273
General Notes.—
Procellariidæ versus Hydrobatidæ, 276;
Long-tailed Jaeger in Indiana. 276;
Larus canus brachyrhynchus in Wyoming, 276;
Polysticta Eyton versus Stellaris Bonaparte, 277;
Further Record of the European Widgeon at Madison, Wis., 277;
A Late Record for Rallus elegans for Maine, 277;
The Proper Name of the Ruff, 278;
Heteractitis versus Heteroscelus, 278;
The Status of Charadrius rubricollis Gmelin, 279;
A Self-tamed Ruffed Grouse, 279;
Unusual Contents of a Mourning Dove’s Nest, 281;
Mourning Dove Wintering in Vermont, 282;
Thrasaetos versus Harpia, 282;
The Status of the Generic Name Archibuteo, 282;
Harris’s Hawk (Parabuteo unicinctus harrisi) in Kansas, 283;
The Proper Name for the Texas Barred Owl, 283;
Concerning a Note of the Long-eared Owl, 283;
The Short-eared Owl Breeding on Nantucket, 284;
Early Occurrence of the Snowy Owl and the Pine Grosbeak in
Monroe County, New York,
285;
The Deep Plantar Tendons in the Puff-birds, Jacamars and their
Allies,
285;
The Status of the Genus Hypocentor Cabanis, 286;
A Correction Involving Some Juncos, 287;
An Additional Record of Ammodramus savannarum bimaculutus
in Eastern Washington,
287;
The Dickcissel in New Hampshire, 288;
General Notes.—
Early Nesting of the Loggerhead Shrike, 288;
A Note on the Decrease of the Carolina Wren near Washington,
D. C.,
289;
The Affinities of Chamæthlypis, 290;
Blue-winged Warbler Feeding a Young Field Sparrow, 291;
The Blue-winged Warbler near Boston, 292;
Nashville Warbler (Vermivora ruficapilla) in New York in Winter, 293;
Four Rare Birds in Sussex County, New Jersey, 293;
Notes from a Connecticut Pine Swamp, 293;
The Name erythrogaster, 294;
Constant Difference in Relative Proportions of Parts as a
Specific Character,
295;
“Off” Flavors of Wildfowl, 296.
Recent Literature.—
‘The Game Birds of California,’ 297;
Mathews’ ‘The Birds of Australia,’ 299;
De Fenis on Bird Song in its Relation to Music, 300;
Dwight on a New Gull, 301;
McAtee on the Food Habits of the Mallard Ducks, 301;
Stone on Birds of the Canal Zone. 302;
Shufeldt on the Young Hoatzin, 302;
Riley on Celebes Birds, 302;
Oberholser’s ‘Mutanda Ornithologica V,’ 303;
Miller’s ‘Birds of Lewiston-Auburn and Vicinity,’ 303;
Recent Papers by Bangs, 304;
Economic Ornithology in Recent Entomological Publications, 304;
The Ornithological Journals, 307;
Ornithological Articles in Other Journals, 312;
Publications Received, 314.
Correspondence.—Identifications (Characters vs. Geography), 316.
Notes and News.—
Obituary: Frederick DuCane Godman, 319;
General Notes.—
Robert Day Hoyt, 319;
The Mailliard Collection, 320;
Recent Expeditions, 321;
The Flemming Collection, 321;
Rare Birds in the Philadelphia Zoo, 321;
Meeting of the R. A. O. U., 322;
U. S. National Museum Collection, 322;
A. O. U. Check-List, 322;
New National Parks, 322;
Geographic Distribution of A. O. U. Membership, 323;
The Migratory Bird Law, 323;
The Delaware Valley Ornithological Club, 323;
Common Names of Birds, 324;
Birds of Pennsylvania, New Jersey and Delaware, 324.
‘THE AUK,’ published quarterly as the Organ of the American
Ornithologists’ Union, is edited, beginning with volume for 1912, by
Dr. Witmer Stone.
Terms:—$3.00 a year, including postage, strictly in advance.
Single numbers, 75 cents. Free to Honorary Fellows, and to Fellows,
Members, and Associates of the A. O. U. not in arrears for dues.
The Office of Publication is at 30 Boylston St., Cambridge, Boston,
Mass.
Subscriptions may also be addressed to Dr. Jonathan Dwight,
Business Manager, 134, W. 71st St., New York, N. Y. Foreign
Subscribers may obtain ‘The Auk’ through Witherby & Co., 326,
High Holborn, London, W. C.
All articles and communications intended for publication and
all books and publications for notice, may be sent to DR.
WITMER STONE, Academy of Natural Sciences, Logan Square,
Philadelphia, Pa.
Manuscripts for general articles must await their turn for
publication if others are already on file but they must be in the
editor’s hands at least six weeks, before the date of issue of the
number for which they are intended, and manuscripts for ‘General
Notes’, ‘Recent Literature’, etc., not later than the first of the month
preceding the date of the number in which it is desired they shall
appear.
Plate VII.
Olive Thorne Miller
THE AUK:
A QUARTERLY JOURNAL OF
ORNITHOLOGY.
Vol. XXXVI APRIL, 1919 No. 2
MRS. OLIVE THORNE MILLER.
BY FLORENCE MERRIAM BAILEY.
Plate VII.
Little more than a month after the last meeting of the A. O. U., at
which greetings were sent from the Council to Mrs. Miller as the
oldest living member of the Union, came the announcement of her
death, on December 26, 1918. Born on June 25, 1831, she had
indeed been allotted a full span, and for thirty-one of her eighty-
seven years she had been associated with the American
Ornithologists’ Union joining four years after it was founded and
being made Member in 1901 when that class was established.
Harriet Mann—for the more familiar name of Olive Thorne Miller
was the pen name adopted after her marriage—was born at Auburn,
New York, where her father, Seth Hunt, was a banker; but she was
of New England ancestry on both sides of the family, her paternal
grandfather being an importing merchant of Boston, and her great-
grandfather, Captain Benjamin Mann, having organized a company
during the revolution of which he was in command at Bunker Hill.
From Auburn the family moved to Ohio when she was eleven
years old, making the journey, in lieu of railroads, by “packet” on the
canal through the Mohawk Valley, by steamer across Lake Erie, and
finally by an old-fashioned thoroughbrace coach for twenty-five miles
through Ohio—a journey full of romance to an imaginative child, and
described entertainingly in one of Mrs. Miller’s delightful and in this
case largely autobiographical child stories, ‘What Happened to
Barbara.’ In Ohio she spent five years in a small college town where
she attended private schools, among them one of the Select Schools
of that generation, with an enrollment of some forty or fifty girls. At
the age of nine, as she says, she “grappled with the problems of
Watts on the Mind!” To offset the dreariness of such work, she and
half a dozen of her intimate friends formed a secret society for
writing stories, two members of the circle afterwards becoming well
known writers. For writing and reading even then were her greatest
pleasures. The strongest influence in her young life, she tells us, was
from books. “Loving them above everything, adoring the very odor
of a freshly printed volume, and regarding a library as nearest
heaven of any spot on earth, she devoured everything she could lay
her hands upon.” As she grew older the shyness from which she had
always suffered increased painfully, and coupled with a morbid
sensitiveness as to what she considered her personal defects made
people a terror to her; but solitary and reticent, she had the writer’s
passion for self expression and it is easy to understand her when
she says, “To shut myself up where no one could see me, and speak
with my pen, was my greatest happiness.”
In 1854, she married Watts Todd Miller, like herself a member of
a well known family of northern New York, and in her conscientious
effort to be a model wife and to master domestic arts to which she
had never been trained, she sacrificed herself unnecessarily. “Many
years I denied myself the joy of my life—the use of my pen,” she
tells us, “and it was not until my children were well out of the
nursery that I grew wise enough to return to it.”
The history of the vicissitudes of her literary life is at once
touching and enlightening. Full of ardor to reform the world, to
prevent needless unhappiness and to set people on the right path,
her first literary attempt was the essay, but as she expressed it, “the
editorial world did not seem to be suffering for any effusions of
mine,” and her manuscripts were so systematically returned that she
was about giving up, concluding during very black days that she had
mistaken her calling; when a practical friend gave her a new point of
view. What did the public care for the opinions of an unknown
writer? she asked. Let her give what it wanted—attractively put
information on matters of fact. Then when her reputation was
established, people might be glad to listen to her views of life.
Philosophically accepting the suggestion, she calmly burned up
her accumulated “sentiments and opinions,” and set about writing
what she termed “sugar-coated pills of knowledge” for children. The
first, the facts of china-making in the guise of a story, she sent to a
religious weekly which had a children’s page, and to her surprise and
delight received a check for it—her first—two dollars! This was
apparently in 1870, and for twelve years, she worked in what she
terms that “Gradgrind field” in which during that period she
published some three hundred and seventy-five articles in religious
weeklies, ‘Our Young Folks,’ ‘The Youth’s Companion,’ ‘The
Independent,’ ‘St. Nicholas,’ ‘The Chicago Tribune,’ ‘Harper’s,’
‘Scribner’s,’ and other papers and magazines, on subjects ranging
from the manufacture of various familiar articles, as needles, thread,
and china to sea cucumbers, spiders, monkeys, and oyster farms;
and during those twelve years, in addition she published five books,
the best known of which were perhaps ‘Little Folks in Feathers and
Fur,’ 1873, ‘Queer Pets at Marcy’s,’ 1880, and ‘Little People of Asia,’
1882.
About this time, having lived in Chicago nearly twenty years, the
Millers, with their two sons and two daughters, moved to Brooklyn,
where they lived until Mr. Miller’s death. Not long after settling in
Brooklyn, when she had spent twelve years mainly on miscellaneous
juvenile work, Mrs. Miller was visited by a friend who gave her a new
subject, completely changing the course of her life. The friend was
none less than Mrs. Sara A. Hubbard, whom she had known as a
book reviewer in Chicago, but who was also an enthusiastic bird
woman—later an Associate of the A. O. U.—and whose greatest
desire in coming to New York had been to see the birds.
As Mrs. Miller naïvely remarks, “of course I could do no less than
to take her to our park, where were birds in plenty.” And here, in
Prospect Park when she was nearly fifty years old—incredible as it
seems in view of her later work—Mrs. Miller got her first introduction
to birds. “I knew absolutely nothing about ornithology,” she
confesses; “indeed, I knew by sight not more than two birds, the
English Sparrow and the Robin, and I was not very sure of a Robin
either! I must say in excuse for myself,” she adds, “that I had never
spent any time in the country and had been absorbed all my life in
books. My friend was an enthusiast, and I found her enthusiasm
contagious. She taught me to know a few birds, a Vireo, the
charming Catbird, and the beautiful Wood Thrush, and indeed before
she left me I became so interested in the Catbird and Thrush that I
continued to visit the park to see them, and after about two
summers’ study the thought one day came to me that I had seen
some things that other people might be interested in. I wrote what I
had observed and sent an article to the ‘Atlantic Monthly’ and it was
accepted with a very precious letter from Mr. Scudder, who was then
editor. All this time my love of birds and my interest in them had
been growing, and soon I cared for no other study. I set up a bird-
room in my house to study them winters and I began to go to their
country haunts in the summer.”
Of the bird-room described so interestingly in ‘Bird Ways’ it is
only necessary to say that first and last Mrs. Miller had about thirty-
five species of birds which she bought from the bird stores in winter
and allowed to fly about in her bird room, where she could study
them unobtrusively at her desk by means of skillfully arranged
mirrors. For twenty summers, from 1883 to 1903, she spent from
one to three months in the country studying the wild birds, visiting
among other sections, Maine, Massachusetts, Vermont, New
Hampshire, New York, Ohio, North Carolina, Michigan, Colorado,
Utah, and California, taking careful notes in the field and writing
them up for publication at the end of the season. To one who has
not known her, the method may sound deliberate and commercial,
but to one who has worked joyfully by her side, each year’s journey
is known to have meant escape from the world, to the ministering
beneficence of Nature. Let her speak for herself.—“To a brain
wearied by the din of the city ... how refreshing is the heavenly
stillness of the country! To the soul tortured by the sights of ills it
cannot cure, wrongs it cannot right, and sufferings it cannot relieve,
how blessed to be alone with nature, with trees living free,
unfettered lives, and flowers content each in its native spot, with
brooks singing of joy and good cheer, with mountains preaching
divine peace and rest!”[1] Freed from city life and the tortures
imposed by her profound human sympathy, each gift of fancy and
imagination, each rare quality of spirit, joined in the celebration of
the new excursion into fields elysian. But while each sight she saw
was given glamour and charm by her imagination and enthusiasm,
her New England conscience ruled her every word and note, and not
one jot or tittle was let by, no word was set down, that could not
pass muster before the bar of scientific truth.
Mrs. Miller’s first bird book was published in 1885 and the others
followed in quick succession although they were interlarded with
magazine articles and books on other subjects—as ‘The Woman’s
Club,’ 1890, ‘Our Home Pets,’ 1894, ‘Four Handed Folk,’ 1896, and a
series of children’s stories, 1904 to 1907. Her eleven bird books,
published by the Houghton, Mifflin Company, were ‘Bird Ways,’ 1885,
‘In Nesting Time,’ 1887, ‘Little Brothers of the Air,’ 1892, ‘A Bird Lover
in the West,’ 1894, ‘Upon the Tree Tops,’ 1897, ‘The First Book of
Birds,’ 1899, ‘The Second Book of Birds,’ 1901, ‘True Bird Stories
from my Note-Books,’ 1902, ‘With the Birds in Maine,’ 1903, ‘The Bird
our Brother,’ 1908, and her last book, ‘The Children’s Book of Birds’—
a juvenile form of the First and Second Book of Birds—1915.
The newspaper and magazine articles of this second period of
Mrs. Miller’s literary work, beginning with the time when she first
began to study birds, were published not only in the principal
religious weeklies and others of the former channels, but by various
syndicates, in ‘Harper’s Bazar,’ and the ‘Atlantic Monthly.’ They
included not only a large number of bird papers, some of which
appeared later in her books, but also articles on general subjects,
proving her friend’s statement, for now that her reputation had
become established on a basis of fact, the public was ready to profit
by her “sentiments and opinions.”
Her last book of field notes—‘With the Birds in Maine’—was
published in 1903, when she was seventy-two, after which time she
was able to do very little active field work and her writing was
confined mainly to children’s books.
In 1902 Mrs. Miller had visited her oldest son, Charles W. Miller,
in California, and fascinated by the outdoor life and the birds and
flowers of southern California, she would have returned to live,
without delay, had it not been that her married daughter, Mrs. Smith,
and her grandchildren lived in Brooklyn. In 1904, however,
accompanied by her younger daughter, Mary Mann Miller, she did
return to California, where her daughter built a cottage on the
outskirts of Los Angeles on the edge of a bird-filled arroyo where
rare fruits and flowers ran riot and the cottage—El Nido—became
embowered in vines and trees.
From 1870-1915, as nearly as can be determined by her
manuscript lists, Mrs. Miller published about seven hundred and
eighty articles, one booklet on birds and twenty-four books—eleven
of them on birds, her books being published mainly by the Houghton
Mifflin Company and E. P. Dutton. When we stop to consider that her
real work did not begin until she was fifty-four, after which four
hundred and five of her articles and nineteen of her books were
written, and moreover that during her later years, by remarkable
self-conquest, she became a lecturer and devoted much of her time
to lecturing on birds in New York, Brooklyn, Philadelphia, and other
towns, we come to a realization of her tireless industry and her
astonishing accomplishment.
When living in Brooklyn she was a member of some of the
leading women’s clubs of New York and Brooklyn, giving her time to
them with the earnest purpose that underlay all her work. In the
midst of her busy life, it is good to recall as an example of her
devotion to her friends, that for years Mrs. Miller gave up one day a
week to visiting an old friend who had been crippled by an accident;
and after she had gone to California took time to make for her a
calendar of three hundred and sixty-five personally selected
quotations from the best in literature.
Among Mrs. Miller’s pleasures during her later years in the East
were the meetings of the Linnæan Society held in the American
Museum of Natural History in New York, and the A. O. U. meetings
which she attended in New York, Philadelphia, Boston, and
Washington, enjoying not only the papers of other workers, but the
rare opportunity to meet those interested in her beloved work. In a
letter written after one of the meetings she exclaimed—“You don’t
know what a good time we have always. We had a real ‘love feast’
this time. Not only all the old standbys—Mr. Brewster, Mr. Sage, Dr.
Allen, Dr. Merriam and the rest, but a lot of Audubonites and John
Burroughs. I went over and stayed with Mrs. May Riley Smith and
attended every session.” In this same letter she speaks of her
promotion to the new class of membership and says, “It is a great
pleasure to have honest work recognized, and encourages one to
keep at it.”
When Mr. Brewster, in view of a discovery made by Mrs. Miller,
wrote in ‘The Auk,’ regretting that one “gifted with rare powers of
observation” should not record at least the more important of her
discoveries in a scientific journal, Mrs. Miller replied in another note
to ‘The Auk,’ confessing that she would not know what was a
discovery; adding with the enthusiasm that vitalized her work—“to
me everything is a discovery; each bird, on first sight, is a new
creation; his manners and habits are a revelation, as fresh and as
interesting to me as though they had never been observed before.”
Explaining her choice of a literary rather than a scientific channel of
expression, she gives the key to her nature work, one of the
underlying principles of all her work—“my great desire is to bring
into the lives of others the delights to be found in the study of
Nature.”
Looking over the bookshelf where the names of Burroughs,
Torrey, Miller, and Bolles call up each its own rare associations, I am
reminded of a bit of advice that came long years ago from Mr.
Burroughs’ kindly pen—“Put your bird in its landscape”—as this
seems the secret of the richness and charm of this rare company of
writers, for while beguiling us with the story of the bird, they have
set it in its landscape, they have brought home to us “the river and
sky,” they have enabled us to see Nature in its entirety.
Remembering this great boon which we owe Mrs. Miller, it seems
rarely fitting that when her three score years and ten were
accomplished, her last days should have been spent in the sunshine
surrounded by the birds and flowers which brought her happiness in
beautiful California.
Professional C and NET 2021st Edition Christian Nagel
AN EXPERIENCE WITH HORNED
GREBES
(COLYMBUS AURITUS).
BY ALEXANDER D. DUBOIS.
Plates VIII-X
The southeastern portion of Teton County, Montana, lying in the
prairie region east of the Rocky Mountains, comprises flat and rolling
bench-lands, traversed at frequent intervals by coulees which are
tributary to the Teton and Sun Rivers. On these benches are
occasional shallow depressions which have no natural drainage.
They form transient “prairie sloughs” which may be dry at one
season and wet meadows or ponds of water at another.
The slough which afforded the present observations is a
crescent-shaped depression, not more than ten or twelve acres in
extent, curving about a knoll upon which stands a homesteader’s
cabin. There are no lakes or water courses in the immediate vicinity.
During the last few years the region has been rapidly transformed
into grain farms. At the time these notes were made the meadow in
question was bordered on three sides by plowed fields. The spring of
1917 was an extremely rainy one, following a winter of much more
than normal snowfall. In consequence, the crescent-shaped meadow
became a marshy sheet of water.
On the open water of this pond two Grebes were seen on several
days in May. On the third of June, while walking around the pond
scanning its surface with a field-glass, I was suddenly amazed to see
a Grebe sitting upon a nest which protruded above the water amid
the scant vegetation. Careful examination showed the bird to be
Colymbus auritus. She slipped from the nest, as I slowly waded
toward her, and swam about in the open water, anxiously watching
my every movement. The interest was mutual. After watching the
bird for some time I went up to the nest and found that it contained
two eggs. Subsequent visits showed that the eggs were deposited at
intervals of two days; the dates of the visits and number of eggs
found at each visit being as follows: June 3 (2); June 5 (3); June 7
(4); June 9 (5); June 12 (6); June 13 (6).

More Related Content

Similar to Professional C and NET 2021st Edition Christian Nagel (20)

PDF
(Ebook) C# 6 and .NET Core 1.0: Modern Cross-Platform Development by Mark J. ...
lokanszucs25
 
PDF
Visual Studio 2008 Beginning Asp Net 3 5 In C# 2008 From Novice To Professi...
guest4c5b8c4
 
PDF
Programming C 50 Building Windows 8 Web And Desktop Applications For The Net ...
starsleunk
 
PPTX
Introduction to C#
Lee Englestone
 
PDF
C 7 and NET Core Modern Cross Platform Development 2nd Edition Mark J. Price
naiheayshae0
 
PDF
ASP.NET 8 Best Practices 1 / converted Edition Jonathan R. Danylko
acuettokiw6535
 
PDF
CodeNotes for NET 1st Edition Gregory Brill
garradmeegan22
 
PDF
C 40 In A Nutshell Fourth Edition Joseph Albahari Ben Albahari
nkokiveloce
 
PPTX
Mini .net conf 2020
Marco Parenzan
 
PDF
Mastering C A Beginners Guide Mohamed Musthafa Mc Divya Sachdeva
yosarabasiul
 
PPT
Synapse india fundamentals of dotnet development
Synapseindiappsdevelopment
 
PDF
CodeNotes for NET 1st Edition Gregory Brill
gvviosh702
 
PDF
Visual studio-2012-product-guide
Aravindharamanan S
 
PDF
Visual studio-2012-product-guide
Aravindharamanan S
 
PDF
Visual studio-2012-product-guide
Aravindharamanan S
 
PDF
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
foegeartemfz
 
PDF
NET Programming A Practical Guide Using C 1st Edition Pradeep Tapadiya
miyekeiven
 
PPT
Introduction to c_sharp
HEM Sothon
 
PPT
Introduction to c_sharp
Jayanta Basak
 
DOCX
Deitel® Series PageHow To Program SeriesAn.docx
theodorelove43763
 
(Ebook) C# 6 and .NET Core 1.0: Modern Cross-Platform Development by Mark J. ...
lokanszucs25
 
Visual Studio 2008 Beginning Asp Net 3 5 In C# 2008 From Novice To Professi...
guest4c5b8c4
 
Programming C 50 Building Windows 8 Web And Desktop Applications For The Net ...
starsleunk
 
Introduction to C#
Lee Englestone
 
C 7 and NET Core Modern Cross Platform Development 2nd Edition Mark J. Price
naiheayshae0
 
ASP.NET 8 Best Practices 1 / converted Edition Jonathan R. Danylko
acuettokiw6535
 
CodeNotes for NET 1st Edition Gregory Brill
garradmeegan22
 
C 40 In A Nutshell Fourth Edition Joseph Albahari Ben Albahari
nkokiveloce
 
Mini .net conf 2020
Marco Parenzan
 
Mastering C A Beginners Guide Mohamed Musthafa Mc Divya Sachdeva
yosarabasiul
 
Synapse india fundamentals of dotnet development
Synapseindiappsdevelopment
 
CodeNotes for NET 1st Edition Gregory Brill
gvviosh702
 
Visual studio-2012-product-guide
Aravindharamanan S
 
Visual studio-2012-product-guide
Aravindharamanan S
 
Visual studio-2012-product-guide
Aravindharamanan S
 
Parallel Programming With Microsoft Net Design Patterns For Decomposition And...
foegeartemfz
 
NET Programming A Practical Guide Using C 1st Edition Pradeep Tapadiya
miyekeiven
 
Introduction to c_sharp
HEM Sothon
 
Introduction to c_sharp
Jayanta Basak
 
Deitel® Series PageHow To Program SeriesAn.docx
theodorelove43763
 

Recently uploaded (20)

PPTX
HIRSCHSPRUNG'S DISEASE(MEGACOLON): NURSING MANAGMENT.pptx
PRADEEP ABOTHU
 
PPTX
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
PPTX
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
PDF
Right to Information.pdf by Sapna Maurya XI D
Directorate of Education Delhi
 
PPTX
THE HUMAN INTEGUMENTARY SYSTEM#MLT#BCRAPC.pptx
Subham Panja
 
PPTX
ABDOMINAL WALL DEFECTS:GASTROSCHISIS, OMPHALOCELE.pptx
PRADEEP ABOTHU
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PPTX
Folding Off Hours in Gantt View in Odoo 18.2
Celine George
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
ENGLISH LEARNING ACTIVITY SHE W5Q1.pptxY
CHERIEANNAPRILSULIT1
 
PPT
digestive system for Pharm d I year HAP
rekhapositivity
 
PPTX
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PDF
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
PDF
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
PDF
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
PDF
NC DHHS Information about Measles and Vaccination
Mebane Rash
 
PPTX
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
FULL DOCUMENT: Read the full Deloitte and Touche audit report on the National...
Kweku Zurek
 
HIRSCHSPRUNG'S DISEASE(MEGACOLON): NURSING MANAGMENT.pptx
PRADEEP ABOTHU
 
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
How to Configure Storno Accounting in Odoo 18 Accounting
Celine George
 
Right to Information.pdf by Sapna Maurya XI D
Directorate of Education Delhi
 
THE HUMAN INTEGUMENTARY SYSTEM#MLT#BCRAPC.pptx
Subham Panja
 
ABDOMINAL WALL DEFECTS:GASTROSCHISIS, OMPHALOCELE.pptx
PRADEEP ABOTHU
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
Folding Off Hours in Gantt View in Odoo 18.2
Celine George
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
ENGLISH LEARNING ACTIVITY SHE W5Q1.pptxY
CHERIEANNAPRILSULIT1
 
digestive system for Pharm d I year HAP
rekhapositivity
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Federal dollars withheld by district, charter, grant recipient
Mebane Rash
 
A guide to responding to Section C essay tasks for the VCE English Language E...
jpinnuck
 
Tips for Writing the Research Title with Examples
Thelma Villaflores
 
NC DHHS Information about Measles and Vaccination
Mebane Rash
 
ANORECTAL MALFORMATIONS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
FULL DOCUMENT: Read the full Deloitte and Touche audit report on the National...
Kweku Zurek
 
Ad

Professional C and NET 2021st Edition Christian Nagel

  • 1. Professional C and NET 2021st Edition Christian Nagel install download https://ebookmeta.com/product/professional-c-and-net-2021st- edition-christian-nagel/ Download more ebook from https://ebookmeta.com
  • 2. We believe these products will be a great fit for you. Click the link to download now, or visit ebookmeta.com to discover even more! Professional C and NET 2021st Edition Nagel https://ebookmeta.com/product/professional-c-and-net-2021st- edition-nagel/ Pro C# 7: With .NET and .NET Core - Eighth Edition Andrew Troelsen https://ebookmeta.com/product/pro-c-7-with-net-and-net-core- eighth-edition-andrew-troelsen/ ASP NET Core Security 1st Edition Christian Wenz https://ebookmeta.com/product/asp-net-core-security-1st-edition- christian-wenz-2/ A History of Enterprise Policy: Government, Small Business and Entrepreneurship 1st Edition Oliver Mallett https://ebookmeta.com/product/a-history-of-enterprise-policy- government-small-business-and-entrepreneurship-1st-edition- oliver-mallett/
  • 3. Society and culture preliminary and HSC Kate Thompson Emma Davidge Phil Webster Marshall Leaver Terence John Lovat Nicole Martirena https://ebookmeta.com/product/society-and-culture-preliminary- and-hsc-kate-thompson-emma-davidge-phil-webster-marshall-leaver- terence-john-lovat-nicole-martirena/ Lonely Planet Best of USA Travel Guide 3rd Edition Lonely Planet https://ebookmeta.com/product/lonely-planet-best-of-usa-travel- guide-3rd-edition-lonely-planet/ Instaread Summaries The Alchemist Instaread https://ebookmeta.com/product/instaread-summaries-the-alchemist- instaread/ Unfuck Your Sleep The No 1 Non Negotiable Necessity for Emotional and Physical Health 1st Edition Faith G. Harper https://ebookmeta.com/product/unfuck-your-sleep-the-no-1-non- negotiable-necessity-for-emotional-and-physical-health-1st- edition-faith-g-harper/ Gods (Forgotten Gods Reverse Harem #3) 1st Edition D.M. Page https://ebookmeta.com/product/gods-forgotten-gods-reverse- harem-3-1st-edition-d-m-page/
  • 4. Fodor s InFocus Charleston with Hilton Head and the Lowcountry Full color Travel Guide 6th Edition Fodor'S Travel Guides https://ebookmeta.com/product/fodor-s-infocus-charleston-with- hilton-head-and-the-lowcountry-full-color-travel-guide-6th- edition-fodors-travel-guides/
  • 6. Table of Contents COVER TITLE PAGE INTRODUCTION THE WORLD OF .NET THE WORLD OF C# WHAT'S NEW IN C# WHAT'S NEW IN ASP.NET CORE WHAT'S NEW WITH WINDOWS WHAT YOU NEED TO WRITE AND RUN C# CODE WHAT THIS BOOK COVERS CONVENTIONS SOURCE CODE ERRATA PART I: The C# Language 1 .NET Applications and Tools FROM .NET FRAMEWORK TO .NET CORE TO .NET .NET TERMS .NET SUPPORT LENGTH APPLICATION TYPES AND TECHNOLOGIES DEVELOPER TOOLS USING THE . NET CLI SUMMARY 2 Core C# FUNDAMENTALS OF C# NULLABLE TYPES USING PREDEFINED TYPES CONTROLLING PROGRAM FLOW
  • 7. ORGANIZATION WITH NAMESPACES WORKING WITH STRINGS COMMENTS C# PREPROCESSOR DIRECTIVES C# PROGRAMMING GUIDELINES SUMMARY 3 Classes, Records, Structs, and Tuples CREATING AND USING TYPES PASS BY VALUE OR BY REFERENCE CLASSES RECORDS STRUCTS ENUM TYPES REF, IN, AND OUT TUPLES VALUETUPLE DECONSTRUCTION PATTERN MATCHING PARTIAL TYPES SUMMARY 4 Object-Oriented Programming in C# OBJECT ORIENTATION INHERITANCE WITH CLASSES MODIFIERS INHERITANCE WITH RECORDS USING INTERFACES GENERICS SUMMARY 5 Operators and Casts OPERATORS
  • 8. USING BINARY OPERATORS TYPE SAFETY OPERATOR OVERLOADING COMPARING OBJECTS FOR EQUALITY IMPLEMENTING CUSTOM INDEXERS USER-DEFINED CONVERSIONS SUMMARY 6 Arrays MULTIPLE OBJECTS OF THE SAME TYPE SIMPLE ARRAYS MULTIDIMENSIONAL ARRAYS JAGGED ARRAYS ARRAY CLASS ARRAYS AS PARAMETERS ENUMERATORS USING SPAN WITH ARRAYS INDICES AND RANGES ARRAY POOLS BITARRAY SUMMARY 7 Delegates, Lambdas, and Events REFERENCING METHODS DELEGATES LAMBDA EXPRESSIONS EVENTS SUMMARY 8 Collections OVERVIEW COLLECTION INTERFACES AND TYPES LISTS
  • 9. STACKS LINKED LISTS SORTED LIST DICTIONARIES SETS PERFORMANCE IMMUTABLE COLLECTIONS SUMMARY 9 Language Integrated Query LINQ OVERVIEW STANDARD QUERY OPERATORS PARALLEL LINQ EXPRESSION TREES LINQ PROVIDERS SUMMARY 10 Errors and Exceptions HANDLING ERRORS PREDEFINED EXCEPTION CLASSES CATCHING EXCEPTIONS USER-DEFINED EXCEPTION CLASSES CALLER INFORMATION SUMMARY 11 Tasks and Asynchronous Programming WHY ASYNCHRONOUS PROGRAMMING IS IMPORTANT TASK-BASED ASYNC PATTERN TASKS ERROR HANDLING CANCELLATION OF ASYNC METHODS ASYNC STREAMS ASYNC WITH WINDOWS APPS
  • 10. SUMMARY 12 Reflection, Metadata, and Source Generators INSPECTING CODE AT RUNTIME AND DYNAMIC PROGRAMMING CUSTOM ATTRIBUTES USING REFLECTION USING DYNAMIC LANGUAGE EXTENSIONS FOR REFLECTION EXPANDOOBJECT SOURCE GENERATORS SUMMARY 13 Managed and Unmanaged Memory MEMORY MEMORY MANAGEMENT UNDER THE HOOD STRONG AND WEAK REFERENCES WORKING WITH UNMANAGED RESOURCES UNSAFE CODE SPAN<T> PLATFORM INVOKE SUMMARY PART II: Libraries 14 Libraries, Assemblies, Packages, and NuGet THE HELL OF LIBRARIES ASSEMBLIES CREATING AND USING LIBRARIES CREATING NUGET PACKAGES MODULE INITIALIZERS SUMMARY 15 Dependency Injection and Configuration WHAT IS DEPENDENCY INJECTION? USING THE .NET DI CONTAINER
  • 11. USING THE HOST CLASS LIFETIME OF SERVICES INITIALIZATION OF SERVICES USING OPTIONS USING CONFIGURATION FILES CONFIGURATION WITH .NET APPLICATIONS AZURE APP CONFIGURATION SUMMARY 16 Diagnostics and Metrics DIAGNOSTICS OVERVIEW LOGGING METRICS ANALYTICS WITH VISUAL STUDIO APP CENTER APPLICATION INSIGHTS SUMMARY 17 Parallel Programming OVERVIEW PARALLEL CLASS TASKS CANCELLATION FRAMEWORK CHANNELS TIMERS THREADING ISSUES INTERLOCKED MONITOR SPINLOCK WAITHANDLE MUTEX SEMAPHORE EVENTS BARRIER
  • 12. READERWRITERLOCKSLIM LOCKS WITH AWAIT SUMMARY 18 Files and Streams OVERVIEW MANAGING THE FILE SYSTEM ITERATING FILES WORKING WITH STREAMS USING READERS AND WRITERS COMPRESSING FILES WATCHING FILE CHANGES JSON SERIALIZATION USING FILES AND STREAMS WITH THE WINDOWS RUNTIME SUMMARY 19 Networking OVERVIEW WORKING WITH UTILITY CLASSES USING SOCKETS USING TCP CLASSES USING UDP USING WEB SERVERS THE HTTPCLIENT CLASS HTTPCLIENT FACTORY SUMMARY 20 Security ELEMENTS OF SECURITY VERIFYING USER INFORMATION ENCRYPTING DATA ENSURING WEB SECURITY SUMMARY
  • 13. 21 Entity Framework Core INTRODUCING EF CORE CREATING A MODEL SCAFFOLDING A MODEL FROM THE DATABASE MIGRATIONS WORKING WITH QUERIES LOADING RELATED DATA WORKING WITH RELATIONSHIPS SAVING DATA CONFLICT HANDLING USING TRANSACTIONS USING AZURE COSMOS DB SUMMARY 22 Localization GLOBAL MARKETS NAMESPACE SYSTEM.GLOBALIZATION RESOURCES LOCALIZATION WITH ASP.NET CORE LOCALIZATION WITH WINUI SUMMARY 23 Tests OVERVIEW UNIT TESTING USING A MOCKING LIBRARY ASP.NET CORE INTEGRATION TESTING SUMMARY PART III: Web Applications and Services 24 ASP.NET Core UNDERSTANDING WEB TECHNOLOGIES CREATING AN ASP.NET CORE WEB PROJECT
  • 14. ADDING CLIENT-SIDE CONTENT CREATING CUSTOM MIDDLEWARE ENDPOINT ROUTING REQUEST AND RESPONSE SESSION STATE HEALTH CHECKS DEPLOYMENT SUMMARY 25 Services UNDERSTANDING TODAY'S SERVICES REST SERVICES WITH ASP.NET CORE CREATING A .NET CLIENT USING EF CORE WITH SERVICES AUTHENTICATION AND AUTHORIZATION WITH AZURE AD B2C IMPLEMENTING AND USING SERVICES WITH GRPC USING AZURE FUNCTIONS MORE AZURE SERVICES SUMMARY 26 Razor Pages and MVC SETTING UP SERVICES FOR RAZOR PAGES AND MVC RAZOR PAGES ASP.NET CORE MVC SUMMARY 27 Blazor BLAZOR SERVER AND BLAZOR WEBASSEMBLY CREATING A BLAZOR SERVER WEB APPLICATION BLAZOR WEBASSEMBLY RAZOR COMPONENTS
  • 15. SUMMARY 28 SignalR OVERVIEW CREATING A SIMPLE CHAT USING SIGNALR GROUPING CONNECTIONS STREAMING WITH SIGNALR SUMMARY PART IV: Apps 29 Windows Apps INTRODUCING WINDOWS APPS INTRODUCING XAML WORKING WITH CONTROLS WORKING WITH DATA BINDING IMPLEMENTING NAVIGATION IMPLEMENTING LAYOUT PANELS SUMMARY 30 Patterns with XAML Apps WHY MVVM? DEFINING THE MVVM PATTERN SAMPLE SOLUTION MODELS SERVICES VIEW MODELS VIEWS MESSAGING USING EVENTS SUMMARY 31 Styling Windows Apps STYLING SHAPES GEOMETRY
  • 16. TRANSFORMATION BRUSHES STYLES AND RESOURCES TEMPLATES ANIMATIONS VISUAL STATE MANAGER SUMMARY INDEX COPYRIGHT DEDICATION ABOUT THE AUTHOR ABOUT THE TECHNICAL EDITOR ACKNOWLEDGMENTS END USER LICENSE AGREEMENT List of Illustrations Chapter 1 FIGURE 1-1 FIGURE 1-2 Chapter 5 FIGURE 5-1 Chapter 6 FIGURE 6-1 FIGURE 6-2 FIGURE 6-3 FIGURE 6-4 FIGURE 6-5 FIGURE 6-6
  • 17. FIGURE 6-7 Chapter 8 FIGURE 8-1 FIGURE 8-2 FIGURE 8-3 FIGURE 8-4 Chapter 9 FIGURE 9-1 FIGURE 9-2 Chapter 13 FIGURE 13-1 FIGURE 13-2 FIGURE 13-3 FIGURE 13-4 FIGURE 13-5 FIGURE 13-6 Chapter 14 FIGURE 14-1 FIGURE 14-2 FIGURE 14-3 Chapter 16 FIGURE 16-1 FIGURE 16-2 FIGURE 16-3 FIGURE 16-4 FIGURE 16-5 Chapter 17
  • 18. FIGURE 17-1 Chapter 18 FIGURE 18-1 Chapter 19 FIGURE 19-1 FIGURE 19-2 Chapter 20 FIGURE 20-1 Chapter 22 FIGURE 22-1 FIGURE 22-2 FIGURE 22-3 FIGURE 22-4 FIGURE 22-5 FIGURE 22-6 FIGURE 22-7 Chapter 23 FIGURE 23-1 Chapter 24 FIGURE 24-1 FIGURE 24-2 Chapter 25 FIGURE 25-1 FIGURE 25-2 FIGURE 25-3 FIGURE 25-4 FIGURE 25-5
  • 19. FIGURE 25-6 Chapter 26 FIGURE 26-1 FIGURE 26-2 FIGURE 26-3 FIGURE 26-4 FIGURE 26-5 FIGURE 26-6 FIGURE 26-7 FIGURE 26-8 FIGURE 26-9 FIGURE 26-10 Chapter 27 FIGURE 27-1 FIGURE 27-2 FIGURE 27-3 FIGURE 27-4 FIGURE 27-5 Chapter 28 FIGURE 28-1 FIGURE 28-2 FIGURE 28-3 FIGURE 28-4 FIGURE 28-5 Chapter 29 FIGURE 29-1 FIGURE 29-2
  • 20. FIGURE 29-3 FIGURE 29-4 FIGURE 29-5 FIGURE 29-6 FIGURE 29-7 FIGURE 29-8 FIGURE 29-9 FIGURE 29-10 FIGURE 29-11 FIGURE 29-12 FIGURE 29-13 FIGURE 29-14 FIGURE 29-15 FIGURE 29-16 FIGURE 29-17 FIGURE 29-18 FIGURE 29-19 FIGURE 29-20 Chapter 30 FIGURE 30-1 FIGURE 30-2 FIGURE 30-3 FIGURE 30-4 Chapter 31 FIGURE 31-1 FIGURE 31-2 FIGURE 31-3
  • 21. FIGURE 31-4 FIGURE 31-5 FIGURE 31-6 FIGURE 31-7 FIGURE 31-8 FIGURE 31-9 FIGURE 31-10 FIGURE 31-11 FIGURE 31-12 FIGURE 31-13 FIGURE 31-14
  • 22. PROFESSIONAL C# and .NET 2021 Edition Christian Nagel
  • 23. INTRODUCTION EVEN THOUGH .NET was announced in the year 2000, it is not becoming a grandfather technology. Instead, .NET keeps increasing developer traction since it has become open source and is available not only on Windows but also on Linux platforms. .NET can also run within the browser on the client—without the need to install a plugin —by using the WebAssembly standard. As new enhancements for C# and .NET are coming, a focus lies not only on performance gains but also on ease of use. .NET more and more is a choice for new developers. C# is also attractive for long-term developers. Every year, Stack Overflow asks developers about the most loved, dreaded, and wanted programming languages and frameworks. For several years, C# has been within the top 10 of the most loved programming languages. ASP.NET Core now holds the top position as the most loved web framework. .NET Core is number one in the most loved other frameworks/libraries/tools category. See https://insights.stackoverflow.com/survey/2020 for details. When you use C# and ASP.NET Core, you can create web applications and services (including microservices) that run on Windows, Linux, and Mac. You can use the Windows Runtime to create native Windows apps using C#, XAML, and .NET. You can create libraries that you share between ASP.NET Core, Windows apps, and .NET MAUI. You can also create traditional Windows Forms and WPF applications. Most of the samples of this book are built to run on a Windows or Linux system. Exceptions are the Windows app samples that run only on the Windows platform. You can use Visual Studio, Visual Studio Code, or Visual Studio for the Mac as the developer environment; only the Windows app samples require Visual Studio.
  • 24. THE WORLD OF .NET .NET has a long history; the first version was released in the year 2002. The new .NET generation with a complete rewrite of .NET (.NET Core 1.0 in the year 2016) is very young. Recently, many features from the old .NET version have been brought to .NET Core to ease the migration experience. When creating new applications, there is no reason not to move to the new .NET versions. Whether old applications should stay with the old version of .NET or be migrated to the new one depends on the features used, how difficult the migration is, and what advantages you gain after the application is migrated. The best options here need to be considered with an application-by- application analysis. The new .NET provides easy ways to create Windows and web applications and services. You can create microservices running in Docker containers in a Kubernetes cluster; create web applications; use the new OpenTelemetry standard to analyze distributed traces in a vendor-independent manner; create web applications returning HTML, JavaScript, and CSS; and create web applications returning HTML, JavaScript, and .NET binaries that run in the client's browser in a safe and standard way using WebAssembly. You can create Windows applications in traditional ways using WPF and Windows Forms and make use of modern XAML features and controls that support the fluent design with WinUI and mobile applications with .NET MAUI. .NET uses modern patterns. Dependency injection is built into core services, such as ASP.NET Core and EF Core, which not only makes unit testing easier but also allows developers to easily enhance and change features from these technologies. .NET runs on multiple platforms. Besides Windows and macOS, many Linux environments are supported, such as Alpine, CentOS, Debian, Fedora, openSUSE, Red Hat, SLES, and Ubuntu. .NET is open source (https://github.com/dotnet) and freely available. You can find meeting notes for the C# compiler (https://github.com/dotnet/csharplang), the source code for the C#
  • 25. compiler (https://github.com/dotnet/Roslyn), the .NET runtime and libraries (https://github.com/dotnet/runtime), and ASP.NET Core (https://github.com/dotnet/aspnetcore) with Razor Pages, Blazor, and SignalR. Here's a summary of some of the features of the new .NET: .NET is open source. .NET uses modern patterns. .NET supports development on multiple platforms. ASP.NET Core can run on Windows and Linux. THE WORLD OF C# When C# was released in the year 2002, it was a language developed for the .NET Framework. C# was designed with ideas from C++, Java, and Pascal. Anders Hejlsberg had come to Microsoft from Borland and brought experience from the language development of Delphi. At Microsoft, Hejlsberg worked on Microsoft's version of Java, named J++, before creating C#. NOTE Today, Anders Hejlsberg has moved to TypeScript (although he still influences C#), and Mads Torgersen is the project lead for C#. C# improvements are discussed openly at https://github.com/dotnet/csharplang, and you can read C# language proposals and event meeting notes. You can also submit your own proposals for C#. C# started not only as an object-oriented general-purpose programming language but was a component-based programming language that supported properties, events, attributes (annotations), and building assemblies (binaries including metadata). Over time, C# was enhanced with generics, Language Integrated Query (LINQ), lambda expressions, dynamic features, and easier asynchronous programming. C# is not an easy programming language because of the many features it offers, but it's continuously evolving with features that are practical to use. With this, C# is more
  • 26. than an object-oriented or component-based language; it also includes ideas of functional programming—things that are of practical use for a general-purpose language developing all kinds of applications. Nowadays, a new version of C# is released every year. C# 8 added nullable reference types, and C# 9 added records and more. C# 10 is releasing with .NET 6 in 2021 and C# 11 will be released with .NET 7 in 2022. Because of the frequency of changes nowadays, check the GitHub repository for the book (read more in the section “Source Code”) for continuous updates. WHAT'S NEW IN C# Every year, a new version of C# is released, with many new features available in each version. The latest versions include features such as nullable reference types to reduce exceptions of type NullableReferenceException and instead let the compiler help more; features to increase productivity such as indices and ranges; switch expressions that make the switch statement look old; features for using declarations; and enhancements with pattern matching. Top- level statements allow reducing the number of source code lines with small applications and records—classes where the compiler creates boilerplate code for equality comparison, deconstruction, and with expressions. Code generators allow creating code automatically while the compiler runs. All these new features are covered in this book. WHAT'S NEW IN ASP.NET CORE ASP.NET Core now contains new technology for creating web applications: Blazor Server and Blazor WebAssembly. With Blazor, you have a full-stack option to write C# code both for the client and for the server. With Blazor Server, the Razor components you create containing HTML and C# code run on the server. With Blazor WebAssembly, Razor components written with C# and HTML run on the client using the HTML 5 standard WebAssembly that allows you to run binary code in the browser, which is supported by all modern web browsers.
  • 27. For creating services, you can now use gRPC with ASP.NET Core for binary communication between services. This is a great option for service-to-service communication to reduce the bandwidth needed, as well as CPU and memory usage if a lot of data transfer is needed. WHAT'S NEW WITH WINDOWS For developing applications for Windows, a new technology combines the features of the Universal Windows Platform and desktop applications: WinUI 3. WinUI is the native UI platform for Windows 10 applications. With WinUI 3, you can use modern XAML code that includes compiled binding to create desktop applications. New controls with Microsoft's fluent design system are available. These controls are not delivered with the Windows Runtime as was previously the case with the Universal Windows Platform (UWP). These controls are developed independently of the Windows 10 version that allows you to use the newest controls with Windows 10 versions 1809 and above. As the roadmap available with WinUI shows, these new controls will be usable from WPF applications as well. WHAT YOU NEED TO WRITE AND RUN C# CODE .NET runs on Windows, Linux, and Mac operating systems. You can create and build your programs on any of these operating systems using Visual Studio Code (https://code.visualstudio.com). You can build and run most of the samples on Windows or Linux and use the .NET development tools of your choice. Only the WinUI applications require you to use the Windows platform, and here, Visual Studio is the best option to use. The minimum version required to build and run the WinUI application is version 16.10. The command line plays an important part when using the .NET CLI and the Azure CLI; you can use the new Windows Terminal. With the newest Windows 10 versions, this terminal is delivered as part of Windows. With older versions, you can download it from the Microsoft Store.
  • 28. Most .NET developers use the Windows platform as their development machine. When using the Windows Subsystem for Linux (WSL 2), you can build and run your .NET applications in a Linux environment, and you can install different Linux distributions from your Windows environment and access the same files. Visual Studio even allows debugging your .NET applications while they run in a Linux environment on WSL 2. With some samples of the book, Microsoft Azure is shown as an optional hosting environment to run your web applications, use Azure Functions, and use Entity Framework Core to access SQL Server and Azure Cosmos DB. For this, you can use a free trial offering from Microsoft Azure; visit https://azure.microsoft.com/free to register.
  • 29. WHAT THIS BOOK COVERS This book covers these four major parts: The C# language Using base class libraries from .NET Developing web applications and services Developing Windows applications Let's get into the different parts and all the chapters in more detail. Part I, “The C# Language” The first part of this book covers all the aspects of the C# programming language. You learn the syntax options and see how the C# syntax integrates with classes and interfaces from .NET. This part gives good grounding in the C# language. This section doesn't presume knowledge of any particular programming language, but it's assumed you are an experienced programmer. You start looking at C#'s basic syntax and data types before getting into advanced C# features. Chapter 1, “.NET Applications and Tools,” covers what you need to know to create .NET applications. You learn about the .NET CLI and create a Hello World application using C# 9 top-level statements. Chapter 2, “Core C#,” dives into core C# features and gives you details on top-level statements and information on declaration of variables and data types. The chapter covers target-typed new expressions, explains nullable reference types, and defines a program flow that includes the new switch expressions. Chapter 3, “Classes, Records, Structs, and Tuples,” gives you information to create reference or value types, create and use tuples, and make use of the C# 9 enhancement to create and use records.
  • 30. Chapter 4, “Object-Oriented Programming in C#,” goes into details of object-oriented techniques with C# and demonstrates all the C# keywords for object orientation. It also covers using inheritance with C# 9 records. Chapter 5, “Operators and Casts,” explains the C# operators, and you also learn how to overload standard operators for custom types. Chapter 6, “Arrays,” doesn't stop with simple arrays; you learn using multidimensional and jagged arrays, use the Span type to access arrays, and use the new index and range operators to access arrays. Chapter 7, “Delegates, Lambdas, and Events,” covers .NET pointers to methods, lambda expressions with closures, and .NET events. Chapter 8, “Collections,” dives into the different kind of collections, such as lists, queues, stacks, dictionaries, and immutable collections. The chapter also gives you the information you need to decide which collection to use in what scenario. Chapter 9, “Language Integrated Query,” gives you the C# language integrated query features to query data from your collections. You also learn how to use multiple CPU cores with a query and what's behind expression trees that are used when you use LINQ to access your database with Entity Framework Core. Chapter 10, “Errors and Exceptions,” covers how you should deal with errors, throw and catch exceptions, and filter exceptions when catching them. Chapter 11, “Tasks and Asynchronous Programming,” shows the C# keywords async and await in action— not only with the task- based async pattern but also with async streams, which is a new feature since C# 8. Chapter 12, “Reflection, Metadata, and Source Generators,” covers using and reading attributes with C#. The attributes will not just be read using reflection, but you'll also see the
  • 31. functionality of source generators that allow creating source code during compile time. Chapter 13, “Managed and Unmanaged Memory,” is the last chapter of Part I, which not only shows using the IDisposable interface with the using statement and the new using declaration but also demonstrates using the Span type with managed and unmanaged memory. You can read about using Platform Invoke both with Windows and with Linux environments. Part II, “Libraries” Part II starts with creating custom libraries and NuGet packages, but the major topics covered with Part II are for using .NET libraries that are important for all application types. Chapter 14, “Libraries, Assemblies, Packages, and NuGet,” explains the differences between assemblies and NuGet packages. In this chapter, you learn how to create NuGet packages and are introduced to a new C# feature, module initializers, which allow you to run initial code in a library. Chapter 15, “Dependency Injection and Configuration,” gives detail about how the Host class is used to configure a dependency injection container and the built-in options to retrieve configuration information from a .NET application with different configuration providers, including Azure App Configuration and user secrets. Chapter 16, “Diagnostics and Metrics,” continues using the Host class to configure logging options. You also learn about reading metric information that's offered from some NET providers, using Visual Studio App Center, and extending logging for distributed tracing with OpenTelemetry. Chapter 17, “Parallel Programming,” covers myriad features available with .NET for parallelization and synchronization. Chapter 11 shows the core functionality of the Task class. In Chapter 17, more of the Task class is shown, such as forming task hierarchies and using value tasks. The chapter goes into issues of parallel programming such as race conditions and deadlocks,
  • 32. and for synchronization, you learn about different features available with the lock keyword, the Monitor, SpinLock, Mutex, Semaphore classes, and more. Chapter 18, “Files and Streams,” not only covers reading and writing from the file system with new stream APIs that allow using the Span type but also covers the new .NET JSON serializer with classes in the System.Text.Json namespace. In Chapter 19, “Networking,” you learn about foundational classes for network programming, such as the Socket class and how to create applications using TCP and UDP. You also use the HttpClient factory pattern to create HttpClient objects with automatic retries if transient errors occur. Chapter 20, “Security,” gives you information about cryptography classes for encrypting data, explains how to use the new Microsoft.Identity platform for user authentication, and provides information on web security and what you need to be aware of with encoding issues as well as cross-site request forgery attacks. Chapter 21, “Entity Framework Core,” covers reading and writing data from a database—including the many features offered from EF Core, such as shadow properties, global query filters, many-to-many relations, and what metric information is now offered by EF Core—and reading and writing to Azure Cosmos DB with EF Core. In Chapter 22, “Localization,” you learn to localize applications using techniques that are important both for Windows and web applications. Chapter 23, “Tests,” covers creating unit tests, analyzing code coverage with the .NET CLI, using a mocking library when creating unit tests, and what features are offered by ASP.NET Core to create integration tests. Part III, “Web Applications and Services” Part III of this book is dedicated to ASP.NET Core technologies for creating web applications and services, no matter whether you run
  • 33. these applications and services in your on-premises environment or in the cloud making use of Azure App Services, Azure Static Web Apps, or Azure Functions. Chapter 24, “ASP.NET Core,” gives you the foundation of ASP.NET Core. Based on the dependency injection container you learned about in Part II, this chapter shows how ASP.NET Core makes use of middleware to add functionality to every HTTP request and define routes with ASP.NET Core endpoint routing. Chapter 25, “Services,” dives into creating microservices using different technologies such as ASP.NET Core as well as using Azure Functions and gRPC for binary communication. Chapter 26, “Razor Pages and MVC,” is about interacting with users with ASP.NET Core technologies. It covers Razor pages, Razor views, and functionality such as tag helpers and view components. Chapter 27, “Blazor,” is about the newest enhancement of ASP.NET Core with Razor components, which allows you to implement C# code running either on the server or in the client using WebAssembly. You learn about the differences between Blazor Server and Blazor WebAssembly, what the restrictions are with these technologies, and the built-in components available. Chapter 28, “SignalR,” covers the real-time functionality available with ASP.NET Core to send information to a group of clients and how you can use C# async streams with SignalR. Part IV, “Apps” Part IV of this book is dedicated to XAML code and creating Windows applications with the native UI platform for Windows 10: WinUI. Much of the information you get here can also be applied to WPF applications and to .NET MAUI and developing XAML-based applications for mobile platforms.
  • 34. Chapter 29, “Windows Apps,” gives you foundational information on XAML, including dependency properties and attached properties. You learn how to create custom markup extensions and about the control categories available with WinUI, including advanced techniques such as adaptive triggers and deferred loading. Chapter 30, “Patterns with XAML Apps,” gives you the information you need to use the MVVM pattern and how you can share as much code as possible between different XAML- based technologies such as WinUI, WPF, and .NET MAUI. Chapter 31, “Styling Windows Apps,” explains XAML shapes and geometry elements, dives into styles and control templates, gives you information on creating animations, and explains how you can use the Visual State Manager with your XAML-based applications. CONVENTIONS To help you get the most from the text and keep track of what's happening, I use some conventions throughout the book. WARNING Warnings hold important, not-to-be-forgotten information that is directly relevant to the surrounding text. NOTE Notes indicate notes, tips, hints, tricks, and/or asides to the current discussion. As for styles in the text: We highlight new terms and important words when we introduce them. We show keyboard strokes like this: Ctrl+A. We show filenames, URLs, and code within the text like so: persistence.properties.
  • 35. We present code in two different ways: We use a monofont type with no highlighting for most code examples. We use bold to emphasize code that's particularly important in the present context or to show changes from a previous code snippet. SOURCE CODE As you work through the examples in this book, you may choose either to type all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wiley.com. When at the site, simply locate the book's title (either by using the Search box or by using one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book. NOTE Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-1-119-79720-3. After you download the code, just decompress it with your favorite compression tool. The source code is also available on GitHub at https://www.github.com/ProfessionalCSharp/ProfessionalCSharp202 1. With GitHub, you can also open each source code file with a web browser. When you use the website, you can download the complete source code in a zip file. You can also clone the source code to a local directory on your system. Just install the Git tools, which you can do with Visual Studio or by downloading the Git tools from https://git-scm.com/downloads for Windows, Linux, and Mac. To clone the source code to a local directory, use git clone: > git clone https://www.github.com/ProfessionalCSharp/ProfessionalCSharp 2021 With this command, the complete source code is copied to the subdirectory ProfessionalCSharp2021. From there, you can start working with the source files.
  • 36. As updates of .NET become available (until the next edition of the book will be released), the source code will be updated on GitHub. Check the readme.md file in the GitHub repo for updates. If the source code changes after you cloned it, you can pull the latest changes after changing your current directory to the directory of the source code: > git pull In case you've made some changes on the source code, git pull might result in an error. If this happens, you can stash away your changes and pull again: > git stash > git pull The complete list of git commands is available at https://git- scm.com/docs. In case you have questions on the source code, use discussions with the GitHub repository. If you find an error with the source code, create an issue. Open https://github.com/ProfessionalCSharp/ProfessionalCSharp2021 in the browser, click the Issues tab, and click the New Issue button. This opens an editor. Just be as descriptive as possible to describe your issue. For reporting issues, you need a GitHub account. If you have a GitHub account, you can also fork the source code repository to your account. For more information on using GitHub, check https://guides.github.com/activities/hello-world. NOTE You can read the source code and issues and clone the repository locally without joining GitHub. For posting issues and creating your own repositories on GitHub, you need your own GitHub account. For basic functionality, GitHub is free (see https://github.com/pricing). ERRATA We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you
  • 37. find an error in one of our books, like a spelling mistake or faulty piece of code, we would be grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time you can help provide even higher-quality information. To find the errata page for this book, go to www.wiley.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that have been submitted for this book and posted by the book's editors. If you don't spot “your” error on the Book Errata page, go to https://support.wiley.com/s/article/reporting-a-wiley-book- error for information about how to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.
  • 38. PART I The C# Language CHAPTER 1: .NET Applications and Tools CHAPTER 2: Core C# CHAPTER 3: Classes, Records, Structs, and Tuples CHAPTER 4: Object-Oriented Programming in C# CHAPTER 5: Operators and Casts CHAPTER 6: Arrays CHAPTER 7: Delegates, Lambdas, and Events CHAPTER 8: Collections CHAPTER 9: Language Integrated Query CHAPTER 10: Errors and Exceptions CHAPTER 11: Tasks and Asynchronous Programming CHAPTER 12: Reflection, Metadata, and Source Generators CHAPTER 13: Managed and Unmanaged Memory
  • 39. 1 .NET Applications and Tools WHAT'S IN THIS CHAPTER? From .NET Framework to .NET Core to .NET .NET terms .NET support length Application types and technologies Developer tools Using the .NET command-line interface Programming “Hello World!” Technologies for creating web apps CODE DOWNLOADS FOR THIS CHAPTER The source code for this chapter is available on the book page at www.wiley.com. Click the Downloads link. The code can also be found at https://github.com/ProfessionalCSharp/ProfessionalCSharp2021 in the directory 1_CS/HelloWorld. The code for this chapter is divided into the following major examples: HelloWorld WebApp SelfContainedHelloWorld
  • 40. FROM .NET FRAMEWORK TO .NET CORE TO .NET The first version of .NET was released in 2002. Since the first version, many things have changed. The first era of .NET was the .NET Framework that offered Windows Forms for Windows desktop development and Web Forms to create web applications. This version of .NET was available only for Microsoft Windows. At that time, Microsoft also invented a standard for C# at ECMA (https://www.ecma- international.org/publications/standards/Ecma-334.htm). Later, Silverlight used a subset of this technology with a limited library and runtime running in browsers using a browser add-in. At that time, the company Ximian developed the Mono runtime. This runtime was available for Linux and Android and offered a subset of Microsoft .NET’s functionality. Later, Novell bought Ximian, and Novell was later bought by The Attachmate Group. As the new organization lost interest in .NET, Miguel de Icaza (the founder of Ximian) started Xamarin and took the interesting .NET parts into his new organization to start .NET for Android and iOS. Nowadays, Xamarin belongs to Microsoft, and the Mono runtime is part of the dotnet runtime repo (https://github.com/dotnet/runtime). Silverlight started .NET development for other devices with different form factors, which have different needs for .NET. Silverlight was not successful in the long term because HTML5 offered features that previously only were available by using browser add-ins. However, Silverlight started moving .NET in other directions that resulted in .NET Core. .NET Core was the biggest change to .NET since its inception. .NET code became open-source, you could create apps for other platforms, and the new code base of .NET is using modern design patterns. The next step is a logical move: the version of .NET after .NET Core 3.1 is .NET 5. The Core name is removed, and version 4 was skipped to send a message to .NET Framework developers that there's a higher version than .NET Framework 4.8, and it's time to move to .NET 5 for creating new applications. For developers using .NET Core, the move is an easy one. With existing applications, usually all that needs to be changed is the version number of the target framework. Moving applications from the .NET Framework is not that easy and might require bigger changes. Depending on the application type, more or less change is needed. .NET Core 3.x supports WPF and Windows Forms applications. With these application types, the change can be easy. However, existing .NET Framework WPF applications may have features that cannot be moved that easily to the new .NET. For example, application domains are not supported with .NET Core and .NET 5. Moving Windows Communication Foundation (WCF) services to .NET 5 is not at all
  • 41. easy. The server part of WCF is not supported in the new .NET era. The WCF part of the application needs to be rewritten to ASP.NET Core Web API, gRPC, or another communication technology that fulfills the needs. With existing applications, it can be useful to stay with the .NET Framework instead of changing to the new .NET because the old framework will still be maintained for many years to come. The .NET Framework is installed with Windows 10, and support for the .NET Framework has a long target that is bound to the support of the Windows 10 versions. The new .NET and NuGet packages allow Microsoft to provide faster update cycles for delivering new features. It's not easy to decide what technology should be used for creating applications. This chapter helps you with that decision. It gives you information about the different technologies available for creating Windows and web apps and services, offers guidance on what to choose for database access, and helps with moving from old technologies to new ones. You'll also read about the .NET tooling that you can use with the code samples through all the chapters of this book. .NET TERMS Before digging deeper, you should understand concepts and some important .NET terms, such as what's in the .NET SDK and what the .NET runtime is. You also should get a better understanding of the .NET Framework and .NET, when to use the .NET Standard, and the NuGet packages and .NET namespaces. .NET SDK For developing .NET applications, you need to install the .NET SDK. The SDK contains the .NET command-line interface (CLI), tools, libraries, and the runtime. With the .NET CLI, you can create new applications based on templates, restore packages, build and test the application, and create deployment packages. Later in this chapter in the section “.NET CLI,” you will see how to create and build applications. If you use Visual Studio 2019, the .NET SDK is installed as part of Visual Studio. If you don't have Visual Studio, you can install the SDK from https://dot.net. Here, you can find instructions on how to install the SDK on Windows, Mac, and Linux systems. You can install multiple versions of the .NET SDK in parallel. The command > dotnet --list-sdks
  • 42. shows all the different SDK versions that are installed on the system. By default, the latest version is used. NOTE To run the command, you have many different options to start a command prompt. One is the Windows built-in Command Prompt; you can install the new Windows Terminal; if Visual Studio is installed, you can start the Developer Command Prompt; or you can use the bash shell. Read more on the Windows Terminal later in this chapter in the section “Developer Tools.” You can create a global.json file if you do not want to use the latest version of the SDK. The command > dotnet new globaljson creates the file global.json in the current directory. This file contains the version element with the version number currently used. You can change the version number to one of the other SDK versions that is installed: { "sdk": { "version": "5.0.202" } } In the directory of global.json and its subdirectories, the specified SDK version is used. You can verify this with > dotnet --version .NET Runtime On the target system, the .NET SDK is not required. Here you just need to install the .NET runtime. The runtime includes all the core libraries and the dotnet driver. The dotnet driver is used to run the application—for example, the Hello, World application with > dotnet hello-world.dll At https://dot.net, you can find not only instructions to download and install the SDK on different platforms but also the runtime. Instead of installing the runtime on the target system, you also can deliver the runtime as part of the application (which is known as self-contained deployment). This technique is very different from older .NET Framework
  • 43. applications and is covered later in the chapter in the “Using the .NET CLI” section. To see which runtimes are installed, you can use > dotnet --list-runtimes Common Language Runtime The C# compiler compiles C# code to Microsoft Intermediate Language (IL) code. This code is a little bit like assembly code, but it has more object- oriented features. The IL code is run by the Common Language Runtime (CLR). What's done by a CLR? The IL code is compiled to native code by the CLR. The IL code available in .NET assemblies is compiled by a Just-In-Time (JIT) compiler. This compiler creates platform-specific native code. The runtime includes a JIT compiler named RyuJIT. This compiler is not only faster than the previous one, but it also has better support for using Edit & Continue while you're debugging the application with Visual Studio. The runtime also includes a type system with a type loader that is responsible for loading types from assemblies. Security infrastructure with the type system verifies whether certain type system structures are permitted—for example, with inheritance. After instances of types are created, they also need to be destroyed, and memory needs to be recycled. Another feature of the runtime is the garbage collector. The garbage collector cleans up memory from objects that are no longer referenced in the managed heap. The runtime is also responsible for threading. When you are creating a managed thread from C#, it is not necessarily a thread from the underlying operating system. Threads are virtualized and managed by the runtime. NOTE How you can create and manage threads from C# is covered in Chapter 17, “Parallel Programming.” Chapter 13, “Managed and Unmanaged Memory,” gives information about the garbage collector and how to clean up memory. .NET Compiler Platform The C# compiler that's installed as part of the SDK belongs to the .NET Compiler Platform, which is also known by the code name Roslyn. Roslyn allows you to interact with the compilation process, work with syntax trees,
  • 44. and access the semantic model that is defined by language rules. You can use Roslyn to write code analyzers and refactoring features. You also can use Roslyn with a new feature of C# 9, code generators, which are discussed in Chapter 12, “Reflection, Metadata, and Source Generators.” .NET Framework The .NET Framework is the name of the old .NET. The last version available is .NET Framework 4.8. It's not that useful to create new applications with this framework, but of course you can maintain existing applications because this technology will still be supported for many years to come. If existing applications don't get any advantages by moving to new technologies and there's not a lot of maintenance going on, there's no need to switch in the short term. Depending on the technologies used with existing applications, the switch to .NET can be easy. WPF and Windows Forms have been offered with newer technologies since .NET Core 3. However, WPF and Windows applications could have used features where the application architecture might need a change. Examples of technologies that are no longer offered with new versions of .NET are ASP.NET Web Forms, Windows Communication Foundation (WCF), and Windows Workflow Foundation (WF). Instead of ASP.NET Web Forms, you can rewrite applications using ASP.NET Blazor. Instead of WCF, you can use ASP.NET Core Web API or gRPC. Instead of WF, moving to Azure Logic Apps might be useful. .NET Core .NET Core is the new .NET that is used by all new technologies and is a main focus of this book (with the new name .NET). This framework is open source, and you can find it at http://www.github.com/dotnet. The runtime is the CoreCLR repository; the framework containing collection classes, file system access, console, XML, and a lot more is in the CoreFX repository. Unlike the .NET Framework, where the specific version you needed for the application had to be installed on the system, with .NET Core 1.0, the framework, including the runtime, is delivered with the application. Previously, there were times when you might have had problems deploying an ASP.NET web application to a shared server because the provider had older versions of .NET installed; those times are gone. Now you can deliver the runtime with the application, and you are not dependent on the version installed on the server.
  • 45. .NET Core is designed in a modular approach. The framework is split into a large list of NuGet packages. So that you don't have to deal with all the packages, metapackages reference the smaller packages that work together. This even improved with .NET Core 2.0 and ASP.NET Core 2.0. With ASP.NET Core 2.0, you just need to reference Microsoft.AspNetCore.All to get all the packages you typically need with ASP.NET Core web applications. .NET Core can be updated at a fast pace. Even updating the runtime doesn't influence existing applications because the runtime can be installed with the applications. Now Microsoft can improve .NET Core, including the runtime, with faster release cycles. NOTE For developing apps using .NET Core, Microsoft created new command-line utilities. These tools are introduced later in this chapter through a “Hello World!” application in the section “Using the .NET CLI.” .NET Starting with .NET 5, .NET Core has a new name: .NET. Removing “Core” from the name should tell developers who still use the .NET Framework that there's not a new version of the .NET Framework from now on. The .NET Framework is no longer receiving new features. For new applications, you should use .NET. .NET Standard .NET Standard is an important specification when creating and using libraries. .NET Standard offers a contract rather than an implementation. With this contract, available APIs are listed. With every new version of .NET Standard, new APIs are added. APIs are never removed. For example, .NET Standard 2.1 lists more APIs than .NET Standard 1.6. When you're creating a library, you probably want to use as many APIs as possible, so I suggest you choose the most recent .NET Standard version. However, the highest standard version also means the lowest number of platforms that support this standard, so you may need to take that into consideration. A table at https://docs.microsoft.com/dotnet/standard/net-standard gives you the details on what platform supports which version of the standard. For example, .NET Framework 4.6.1 and later support up to .NET Standard
  • 46. 2.0. In addition, .NET Core 3.0 and later (which includes .NET 5 and later) support .NET Standard 2.1. The Universal Windows Platform build 10.0.16299 supports .NET Standard 2.0. Xamarin.Android 10.0 supports .NET Standard 2.1. As of .NET 5, the .NET Standard becomes irrelevant. If you're creating libraries with .NET 5, you can use libraries from .NET 5, .NET 6, and later applications. Similarly, when you're creating libraries with .NET 7, you can use libraries from applications written with .NET 7 and later. However, we can't expect that the .NET Framework, Mono, and other older technologies will just fade away, so .NET Standard will still be needed for many years to come. If you need to support older technologies with your libraries, you'll still need .NET Standard. NOTE Read detailed information about .NET Standard in Chapter 14, “Libraries, Assemblies, Packages, and NuGet.” NuGet Packages In the early days, assemblies were reusable units with applications. That use is still possible (and necessary with some assemblies) when you're adding a reference to an assembly for using the public types and methods from your own code. However, using libraries can mean a lot more than just adding a reference and using it. Using libraries can also mean making some configuration changes or using scripts to take advantage of some features. The target framework determines which binaries you can use. These are reasons to package assemblies within NuGet packages, which are zip files that contain the assembly (or multiple assemblies) as well as configuration information and PowerShell scripts. Another reason for using NuGet packages is that they can be found easily; they're available not only from Microsoft but also from third parties. NuGet packages are easily accessible on the NuGet server at https://www.nuget.org. You can add NuGet packages to applications with the .NET CLI: > dotnet add package <package-name> From the references within a Visual Studio project, you can open the NuGet Package Manager (see Figure 1-1). There you can search for packages and add them to the application. This tool enables you to search for packages that are not yet released (including prerelease options) and define the NuGet server that should be searched for packages. One place to search for
  • 47. packages can be your own shared directory where you've placed your internal packages that you've used. FIGURE 1-1 Namespaces The classes available with .NET are organized in namespaces. Most of these namespaces start with the name System or Microsoft. The following table describes a few of the namespaces to give you an idea about the hierarchy: NAMESPACE DESCRIPTION System.Collections This is the root namespace for collections. Collections are also found within subnamespaces such as System.Collections.Concurrent and System.Collections.Generic. System.Diagnostics This is the root namespace for diagnostics information, such as event logging and tracing (in the namespace System.Diagnostics.Tracing).
  • 48. NAMESPACE DESCRIPTION System.Globalization This is the namespace that contains classes for globalization and localization of applications. System.IO This is the namespace for File input/output (I/O), which includes classes that access files and directories. Readers, writers, and streams are here. System.Net This is the namespace for core networking, such as accessing DNS servers and creating sockets with System.Net.Sockets. System.Threading This is the root namespace for threads and tasks. Tasks are defined within System.Threading.Tasks. Microsoft.Data This is the namespace for accessing databases. Microsoft.Data.SqlClient contains classes that access the SQL Server. The previous classes from System.Data have been repackaged into Microsoft.Data. Microsoft.Extensions.DependencyInjection This is the namespace for the Microsoft DI container that is part of .NET. Microsoft.EntityFrameworkCore To access relational and NoSQL databases, Entity Framework Core can be used. Types are defined in this namespace. .NET SUPPORT LENGTH When you're working in the new era of .NET, you should know about versions with different support cycles. .NET releases differ based on a
  • 49. Current or Long-Term Support LTS moniker. LTS versions are supported at least three years, or for one year after the next LTS version is available. If for example, the next LTS version is available 2.5 years after the previous one was released, and the previous one has a support length of 3.5 years. Current versions are supported for only three months after the next version is available. At the time of this writing, .NET Core 2.2 and 3.0 are current versions that are already no longer supported with security and hot fixes, whereas .NET Core 2.1 and 3.1 are LTS versions that still have support. The following table lists the .NET Core and .NET versions with their release dates, support level, and end-of-life dates: .NET CORE/.NET VERSION RELEASE DATE SUPPORT LEVEL END OF LIFE 1.0 June 27, 2016 LTS June 27, 2019 1.1 Nov. 16, 2016 LTS* June 27, 2019 2.0 Aug. 14, 2017 Current Oct. 1, 2018 2.1 May 30, 2018 LTS Aug. 21, 2021 2.2 Dec. 4, 2018 Current Dec. 23, 2019 3.0 Sep. 23, 2019 Current Mar. 3, 2020 3.1 Dec. 3, 2019 LTS Dec. 3, 2022 5.0 Nov. 10, 2020 Current around Feb. 2022 6.0 Nov. 2021 LTS Nov. 2024 7.0 Nov. 2022 Current Feb. 2024 or earlier in case minor versions are released 8.0 Nov. 2023 LTS Nov. 2026 Starting with .NET 5, the versions become more predictable. Every year in November, a new major release is available. Every second year, the release is an LTS version. Depending on the environment you're working in, you might decide to use LTS or Current versions. With current versions, you get new features faster, but you need to upgrade to newer versions more often. While the application is in its active development stage, you might decide to use the current version. As your application is becoming more stable, you can switch to the next LTS version.
  • 50. Random documents with unrelated content Scribd suggests to you:
  • 54. The Project Gutenberg eBook of The Auk: A Quarterly Journal of Ornithology, Vol. XXXVI APRIL, 1919 No. 2
  • 55. This ebook is for the use of anyone anywhere in the United States and most other parts of the world at no cost and with almost no restrictions whatsoever. You may copy it, give it away or re-use it under the terms of the Project Gutenberg License included with this ebook or online at www.gutenberg.org. If you are not located in the United States, you will have to check the laws of the country where you are located before using this eBook. Title: The Auk: A Quarterly Journal of Ornithology, Vol. XXXVI APRIL, 1919 No. 2 Author: Various Editor: Witmer Stone Release date: April 2, 2019 [eBook #59190] Language: English Credits: Produced by Paul Marshall and the Online Distributed Proofreading Team at http://www.pgdp.net (This file was produced from images generously made available by The Internet Archive) *** START OF THE PROJECT GUTENBERG EBOOK THE AUK: A QUARTERLY JOURNAL OF ORNITHOLOGY, VOL. XXXVI APRIL, 1919 NO. 2 ***
  • 57. Old ┐ CONTINUATION OF THE ┌ New Series, ├ BULLETIN OF THE ┤ Series, Vol. XLIV ┘ NUTTALL ORNITHOLOGICAL CLUB └ Vol. XXXVI The Auk A Quarterly Journal of Ornithology Vol. XXXVI APRIL, 1919 No. 2 PUBLISHED BY The American Ornithologists’ Union
  • 58. CAMBRIDGE, MASS. Entered as second-class mail matter in the Post Office at Boston, Mass. “Acceptance for mailing at special rate of postage provided for in Section 1103, Act of October 3, 1917, authorized on September 23, 1918.”
  • 59. CONTENTS PAGE Mrs. Olive Thorne Miller. By Florence Merriam Bailey. (Plate VII.) 163 An Experience with Horned Grebes (Colymbus auritus). By Alexander D. DuBois. (Plates VIII-X.) 170 Historical Notes on Harris’s Sparrow (Zonotrichia querula). By Harry Harris 180 Notes on the Structure of the Palate in Icteridæ. By Alexander Wetmore 190 The Crow in Colorado. By W. H. Bergtold 198 Winter Robins in Nova Scotia. By Harrison F. Lewis 205 Remarks on Beebe’s ‘Tropical Wild Life.’ By Thomas E. Penard 217 Problems Suggested by Nests of Warblers of the Genus Dendroica. By John Treadwell Nichols 225 On the Popular Names of Birds. By Ernest Thompson Seton 229 The Reality of Species. By Leverett Mills Loomis 235 Geographical Variation in the Black- throated Loons. By A. C. Bent 238 Reasons for Discarding a Proposed Race of the Glaucous Gull (Larus hyperboreus). By Jonathan Dwight, M. D. 242 The Birds of the Red Deer River, Alberta. By P. A. Taverner 248 Fourth Annual List of Proposed Changes in the A. O. U. By Harry C. Oberholser 266
  • 60. Check-List of North American Birds. New Forms of South American Birds and Proposed New Subgenera. By Charles B. Cory 273 General Notes.— Procellariidæ versus Hydrobatidæ, 276; Long-tailed Jaeger in Indiana. 276; Larus canus brachyrhynchus in Wyoming, 276; Polysticta Eyton versus Stellaris Bonaparte, 277; Further Record of the European Widgeon at Madison, Wis., 277; A Late Record for Rallus elegans for Maine, 277; The Proper Name of the Ruff, 278; Heteractitis versus Heteroscelus, 278; The Status of Charadrius rubricollis Gmelin, 279; A Self-tamed Ruffed Grouse, 279; Unusual Contents of a Mourning Dove’s Nest, 281; Mourning Dove Wintering in Vermont, 282; Thrasaetos versus Harpia, 282; The Status of the Generic Name Archibuteo, 282; Harris’s Hawk (Parabuteo unicinctus harrisi) in Kansas, 283; The Proper Name for the Texas Barred Owl, 283; Concerning a Note of the Long-eared Owl, 283; The Short-eared Owl Breeding on Nantucket, 284; Early Occurrence of the Snowy Owl and the Pine Grosbeak in Monroe County, New York, 285; The Deep Plantar Tendons in the Puff-birds, Jacamars and their Allies, 285; The Status of the Genus Hypocentor Cabanis, 286; A Correction Involving Some Juncos, 287; An Additional Record of Ammodramus savannarum bimaculutus in Eastern Washington, 287; The Dickcissel in New Hampshire, 288;
  • 61. General Notes.— Early Nesting of the Loggerhead Shrike, 288; A Note on the Decrease of the Carolina Wren near Washington, D. C., 289; The Affinities of Chamæthlypis, 290; Blue-winged Warbler Feeding a Young Field Sparrow, 291; The Blue-winged Warbler near Boston, 292; Nashville Warbler (Vermivora ruficapilla) in New York in Winter, 293; Four Rare Birds in Sussex County, New Jersey, 293; Notes from a Connecticut Pine Swamp, 293; The Name erythrogaster, 294; Constant Difference in Relative Proportions of Parts as a Specific Character, 295; “Off” Flavors of Wildfowl, 296. Recent Literature.— ‘The Game Birds of California,’ 297; Mathews’ ‘The Birds of Australia,’ 299; De Fenis on Bird Song in its Relation to Music, 300; Dwight on a New Gull, 301; McAtee on the Food Habits of the Mallard Ducks, 301; Stone on Birds of the Canal Zone. 302; Shufeldt on the Young Hoatzin, 302; Riley on Celebes Birds, 302; Oberholser’s ‘Mutanda Ornithologica V,’ 303; Miller’s ‘Birds of Lewiston-Auburn and Vicinity,’ 303; Recent Papers by Bangs, 304; Economic Ornithology in Recent Entomological Publications, 304; The Ornithological Journals, 307; Ornithological Articles in Other Journals, 312; Publications Received, 314. Correspondence.—Identifications (Characters vs. Geography), 316. Notes and News.— Obituary: Frederick DuCane Godman, 319;
  • 62. General Notes.— Robert Day Hoyt, 319; The Mailliard Collection, 320; Recent Expeditions, 321; The Flemming Collection, 321; Rare Birds in the Philadelphia Zoo, 321; Meeting of the R. A. O. U., 322; U. S. National Museum Collection, 322; A. O. U. Check-List, 322; New National Parks, 322; Geographic Distribution of A. O. U. Membership, 323; The Migratory Bird Law, 323; The Delaware Valley Ornithological Club, 323; Common Names of Birds, 324; Birds of Pennsylvania, New Jersey and Delaware, 324. ‘THE AUK,’ published quarterly as the Organ of the American Ornithologists’ Union, is edited, beginning with volume for 1912, by Dr. Witmer Stone. Terms:—$3.00 a year, including postage, strictly in advance. Single numbers, 75 cents. Free to Honorary Fellows, and to Fellows, Members, and Associates of the A. O. U. not in arrears for dues. The Office of Publication is at 30 Boylston St., Cambridge, Boston, Mass. Subscriptions may also be addressed to Dr. Jonathan Dwight, Business Manager, 134, W. 71st St., New York, N. Y. Foreign Subscribers may obtain ‘The Auk’ through Witherby & Co., 326, High Holborn, London, W. C. All articles and communications intended for publication and all books and publications for notice, may be sent to DR. WITMER STONE, Academy of Natural Sciences, Logan Square, Philadelphia, Pa.
  • 63. Manuscripts for general articles must await their turn for publication if others are already on file but they must be in the editor’s hands at least six weeks, before the date of issue of the number for which they are intended, and manuscripts for ‘General Notes’, ‘Recent Literature’, etc., not later than the first of the month preceding the date of the number in which it is desired they shall appear.
  • 65. THE AUK: A QUARTERLY JOURNAL OF ORNITHOLOGY. Vol. XXXVI APRIL, 1919 No. 2
  • 66. MRS. OLIVE THORNE MILLER. BY FLORENCE MERRIAM BAILEY. Plate VII. Little more than a month after the last meeting of the A. O. U., at which greetings were sent from the Council to Mrs. Miller as the oldest living member of the Union, came the announcement of her death, on December 26, 1918. Born on June 25, 1831, she had indeed been allotted a full span, and for thirty-one of her eighty- seven years she had been associated with the American Ornithologists’ Union joining four years after it was founded and being made Member in 1901 when that class was established. Harriet Mann—for the more familiar name of Olive Thorne Miller was the pen name adopted after her marriage—was born at Auburn, New York, where her father, Seth Hunt, was a banker; but she was of New England ancestry on both sides of the family, her paternal grandfather being an importing merchant of Boston, and her great- grandfather, Captain Benjamin Mann, having organized a company during the revolution of which he was in command at Bunker Hill. From Auburn the family moved to Ohio when she was eleven years old, making the journey, in lieu of railroads, by “packet” on the canal through the Mohawk Valley, by steamer across Lake Erie, and finally by an old-fashioned thoroughbrace coach for twenty-five miles through Ohio—a journey full of romance to an imaginative child, and described entertainingly in one of Mrs. Miller’s delightful and in this case largely autobiographical child stories, ‘What Happened to Barbara.’ In Ohio she spent five years in a small college town where she attended private schools, among them one of the Select Schools of that generation, with an enrollment of some forty or fifty girls. At
  • 67. the age of nine, as she says, she “grappled with the problems of Watts on the Mind!” To offset the dreariness of such work, she and half a dozen of her intimate friends formed a secret society for writing stories, two members of the circle afterwards becoming well known writers. For writing and reading even then were her greatest pleasures. The strongest influence in her young life, she tells us, was from books. “Loving them above everything, adoring the very odor of a freshly printed volume, and regarding a library as nearest heaven of any spot on earth, she devoured everything she could lay her hands upon.” As she grew older the shyness from which she had always suffered increased painfully, and coupled with a morbid sensitiveness as to what she considered her personal defects made people a terror to her; but solitary and reticent, she had the writer’s passion for self expression and it is easy to understand her when she says, “To shut myself up where no one could see me, and speak with my pen, was my greatest happiness.” In 1854, she married Watts Todd Miller, like herself a member of a well known family of northern New York, and in her conscientious effort to be a model wife and to master domestic arts to which she had never been trained, she sacrificed herself unnecessarily. “Many years I denied myself the joy of my life—the use of my pen,” she tells us, “and it was not until my children were well out of the nursery that I grew wise enough to return to it.” The history of the vicissitudes of her literary life is at once touching and enlightening. Full of ardor to reform the world, to prevent needless unhappiness and to set people on the right path, her first literary attempt was the essay, but as she expressed it, “the editorial world did not seem to be suffering for any effusions of mine,” and her manuscripts were so systematically returned that she was about giving up, concluding during very black days that she had mistaken her calling; when a practical friend gave her a new point of view. What did the public care for the opinions of an unknown writer? she asked. Let her give what it wanted—attractively put information on matters of fact. Then when her reputation was established, people might be glad to listen to her views of life.
  • 68. Philosophically accepting the suggestion, she calmly burned up her accumulated “sentiments and opinions,” and set about writing what she termed “sugar-coated pills of knowledge” for children. The first, the facts of china-making in the guise of a story, she sent to a religious weekly which had a children’s page, and to her surprise and delight received a check for it—her first—two dollars! This was apparently in 1870, and for twelve years, she worked in what she terms that “Gradgrind field” in which during that period she published some three hundred and seventy-five articles in religious weeklies, ‘Our Young Folks,’ ‘The Youth’s Companion,’ ‘The Independent,’ ‘St. Nicholas,’ ‘The Chicago Tribune,’ ‘Harper’s,’ ‘Scribner’s,’ and other papers and magazines, on subjects ranging from the manufacture of various familiar articles, as needles, thread, and china to sea cucumbers, spiders, monkeys, and oyster farms; and during those twelve years, in addition she published five books, the best known of which were perhaps ‘Little Folks in Feathers and Fur,’ 1873, ‘Queer Pets at Marcy’s,’ 1880, and ‘Little People of Asia,’ 1882. About this time, having lived in Chicago nearly twenty years, the Millers, with their two sons and two daughters, moved to Brooklyn, where they lived until Mr. Miller’s death. Not long after settling in Brooklyn, when she had spent twelve years mainly on miscellaneous juvenile work, Mrs. Miller was visited by a friend who gave her a new subject, completely changing the course of her life. The friend was none less than Mrs. Sara A. Hubbard, whom she had known as a book reviewer in Chicago, but who was also an enthusiastic bird woman—later an Associate of the A. O. U.—and whose greatest desire in coming to New York had been to see the birds. As Mrs. Miller naïvely remarks, “of course I could do no less than to take her to our park, where were birds in plenty.” And here, in Prospect Park when she was nearly fifty years old—incredible as it seems in view of her later work—Mrs. Miller got her first introduction to birds. “I knew absolutely nothing about ornithology,” she confesses; “indeed, I knew by sight not more than two birds, the English Sparrow and the Robin, and I was not very sure of a Robin
  • 69. either! I must say in excuse for myself,” she adds, “that I had never spent any time in the country and had been absorbed all my life in books. My friend was an enthusiast, and I found her enthusiasm contagious. She taught me to know a few birds, a Vireo, the charming Catbird, and the beautiful Wood Thrush, and indeed before she left me I became so interested in the Catbird and Thrush that I continued to visit the park to see them, and after about two summers’ study the thought one day came to me that I had seen some things that other people might be interested in. I wrote what I had observed and sent an article to the ‘Atlantic Monthly’ and it was accepted with a very precious letter from Mr. Scudder, who was then editor. All this time my love of birds and my interest in them had been growing, and soon I cared for no other study. I set up a bird- room in my house to study them winters and I began to go to their country haunts in the summer.” Of the bird-room described so interestingly in ‘Bird Ways’ it is only necessary to say that first and last Mrs. Miller had about thirty- five species of birds which she bought from the bird stores in winter and allowed to fly about in her bird room, where she could study them unobtrusively at her desk by means of skillfully arranged mirrors. For twenty summers, from 1883 to 1903, she spent from one to three months in the country studying the wild birds, visiting among other sections, Maine, Massachusetts, Vermont, New Hampshire, New York, Ohio, North Carolina, Michigan, Colorado, Utah, and California, taking careful notes in the field and writing them up for publication at the end of the season. To one who has not known her, the method may sound deliberate and commercial, but to one who has worked joyfully by her side, each year’s journey is known to have meant escape from the world, to the ministering beneficence of Nature. Let her speak for herself.—“To a brain wearied by the din of the city ... how refreshing is the heavenly stillness of the country! To the soul tortured by the sights of ills it cannot cure, wrongs it cannot right, and sufferings it cannot relieve, how blessed to be alone with nature, with trees living free, unfettered lives, and flowers content each in its native spot, with
  • 70. brooks singing of joy and good cheer, with mountains preaching divine peace and rest!”[1] Freed from city life and the tortures imposed by her profound human sympathy, each gift of fancy and imagination, each rare quality of spirit, joined in the celebration of the new excursion into fields elysian. But while each sight she saw was given glamour and charm by her imagination and enthusiasm, her New England conscience ruled her every word and note, and not one jot or tittle was let by, no word was set down, that could not pass muster before the bar of scientific truth. Mrs. Miller’s first bird book was published in 1885 and the others followed in quick succession although they were interlarded with magazine articles and books on other subjects—as ‘The Woman’s Club,’ 1890, ‘Our Home Pets,’ 1894, ‘Four Handed Folk,’ 1896, and a series of children’s stories, 1904 to 1907. Her eleven bird books, published by the Houghton, Mifflin Company, were ‘Bird Ways,’ 1885, ‘In Nesting Time,’ 1887, ‘Little Brothers of the Air,’ 1892, ‘A Bird Lover in the West,’ 1894, ‘Upon the Tree Tops,’ 1897, ‘The First Book of Birds,’ 1899, ‘The Second Book of Birds,’ 1901, ‘True Bird Stories from my Note-Books,’ 1902, ‘With the Birds in Maine,’ 1903, ‘The Bird our Brother,’ 1908, and her last book, ‘The Children’s Book of Birds’— a juvenile form of the First and Second Book of Birds—1915. The newspaper and magazine articles of this second period of Mrs. Miller’s literary work, beginning with the time when she first began to study birds, were published not only in the principal religious weeklies and others of the former channels, but by various syndicates, in ‘Harper’s Bazar,’ and the ‘Atlantic Monthly.’ They included not only a large number of bird papers, some of which appeared later in her books, but also articles on general subjects, proving her friend’s statement, for now that her reputation had become established on a basis of fact, the public was ready to profit by her “sentiments and opinions.” Her last book of field notes—‘With the Birds in Maine’—was published in 1903, when she was seventy-two, after which time she
  • 71. was able to do very little active field work and her writing was confined mainly to children’s books. In 1902 Mrs. Miller had visited her oldest son, Charles W. Miller, in California, and fascinated by the outdoor life and the birds and flowers of southern California, she would have returned to live, without delay, had it not been that her married daughter, Mrs. Smith, and her grandchildren lived in Brooklyn. In 1904, however, accompanied by her younger daughter, Mary Mann Miller, she did return to California, where her daughter built a cottage on the outskirts of Los Angeles on the edge of a bird-filled arroyo where rare fruits and flowers ran riot and the cottage—El Nido—became embowered in vines and trees. From 1870-1915, as nearly as can be determined by her manuscript lists, Mrs. Miller published about seven hundred and eighty articles, one booklet on birds and twenty-four books—eleven of them on birds, her books being published mainly by the Houghton Mifflin Company and E. P. Dutton. When we stop to consider that her real work did not begin until she was fifty-four, after which four hundred and five of her articles and nineteen of her books were written, and moreover that during her later years, by remarkable self-conquest, she became a lecturer and devoted much of her time to lecturing on birds in New York, Brooklyn, Philadelphia, and other towns, we come to a realization of her tireless industry and her astonishing accomplishment. When living in Brooklyn she was a member of some of the leading women’s clubs of New York and Brooklyn, giving her time to them with the earnest purpose that underlay all her work. In the midst of her busy life, it is good to recall as an example of her devotion to her friends, that for years Mrs. Miller gave up one day a week to visiting an old friend who had been crippled by an accident; and after she had gone to California took time to make for her a calendar of three hundred and sixty-five personally selected quotations from the best in literature.
  • 72. Among Mrs. Miller’s pleasures during her later years in the East were the meetings of the Linnæan Society held in the American Museum of Natural History in New York, and the A. O. U. meetings which she attended in New York, Philadelphia, Boston, and Washington, enjoying not only the papers of other workers, but the rare opportunity to meet those interested in her beloved work. In a letter written after one of the meetings she exclaimed—“You don’t know what a good time we have always. We had a real ‘love feast’ this time. Not only all the old standbys—Mr. Brewster, Mr. Sage, Dr. Allen, Dr. Merriam and the rest, but a lot of Audubonites and John Burroughs. I went over and stayed with Mrs. May Riley Smith and attended every session.” In this same letter she speaks of her promotion to the new class of membership and says, “It is a great pleasure to have honest work recognized, and encourages one to keep at it.” When Mr. Brewster, in view of a discovery made by Mrs. Miller, wrote in ‘The Auk,’ regretting that one “gifted with rare powers of observation” should not record at least the more important of her discoveries in a scientific journal, Mrs. Miller replied in another note to ‘The Auk,’ confessing that she would not know what was a discovery; adding with the enthusiasm that vitalized her work—“to me everything is a discovery; each bird, on first sight, is a new creation; his manners and habits are a revelation, as fresh and as interesting to me as though they had never been observed before.” Explaining her choice of a literary rather than a scientific channel of expression, she gives the key to her nature work, one of the underlying principles of all her work—“my great desire is to bring into the lives of others the delights to be found in the study of Nature.” Looking over the bookshelf where the names of Burroughs, Torrey, Miller, and Bolles call up each its own rare associations, I am reminded of a bit of advice that came long years ago from Mr. Burroughs’ kindly pen—“Put your bird in its landscape”—as this seems the secret of the richness and charm of this rare company of writers, for while beguiling us with the story of the bird, they have
  • 73. set it in its landscape, they have brought home to us “the river and sky,” they have enabled us to see Nature in its entirety. Remembering this great boon which we owe Mrs. Miller, it seems rarely fitting that when her three score years and ten were accomplished, her last days should have been spent in the sunshine surrounded by the birds and flowers which brought her happiness in beautiful California.
  • 75. AN EXPERIENCE WITH HORNED GREBES (COLYMBUS AURITUS). BY ALEXANDER D. DUBOIS. Plates VIII-X The southeastern portion of Teton County, Montana, lying in the prairie region east of the Rocky Mountains, comprises flat and rolling bench-lands, traversed at frequent intervals by coulees which are tributary to the Teton and Sun Rivers. On these benches are occasional shallow depressions which have no natural drainage. They form transient “prairie sloughs” which may be dry at one season and wet meadows or ponds of water at another. The slough which afforded the present observations is a crescent-shaped depression, not more than ten or twelve acres in extent, curving about a knoll upon which stands a homesteader’s cabin. There are no lakes or water courses in the immediate vicinity. During the last few years the region has been rapidly transformed into grain farms. At the time these notes were made the meadow in question was bordered on three sides by plowed fields. The spring of 1917 was an extremely rainy one, following a winter of much more than normal snowfall. In consequence, the crescent-shaped meadow became a marshy sheet of water. On the open water of this pond two Grebes were seen on several days in May. On the third of June, while walking around the pond scanning its surface with a field-glass, I was suddenly amazed to see a Grebe sitting upon a nest which protruded above the water amid the scant vegetation. Careful examination showed the bird to be Colymbus auritus. She slipped from the nest, as I slowly waded toward her, and swam about in the open water, anxiously watching
  • 76. my every movement. The interest was mutual. After watching the bird for some time I went up to the nest and found that it contained two eggs. Subsequent visits showed that the eggs were deposited at intervals of two days; the dates of the visits and number of eggs found at each visit being as follows: June 3 (2); June 5 (3); June 7 (4); June 9 (5); June 12 (6); June 13 (6).