100% found this document useful (1 vote)
34 views

Microsoft Visual C Step by Step Developer Reference 10th Edition John Sharp instant download

The document provides information about the 10th edition of 'Microsoft Visual C# Step by Step' by John Sharp, including details on its content structure and chapters. It also includes links to various other educational resources and eBooks available for download. Additionally, it emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content.

Uploaded by

karemyalkher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
34 views

Microsoft Visual C Step by Step Developer Reference 10th Edition John Sharp instant download

The document provides information about the 10th edition of 'Microsoft Visual C# Step by Step' by John Sharp, including details on its content structure and chapters. It also includes links to various other educational resources and eBooks available for download. Additionally, it emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content.

Uploaded by

karemyalkher
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Microsoft Visual C Step by Step Developer

Reference 10th Edition John Sharp pdf download

https://ebookmeta.com/product/microsoft-visual-c-step-by-step-
developer-reference-10th-edition-john-sharp/

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!

Microsoft Word 2016 Step By Step 1st Edition Lambert

https://ebookmeta.com/product/microsoft-word-2016-step-by-
step-1st-edition-lambert/

Microsoft Word Step by Step Office 2021 and Microsoft


365 1st Edition Joan Lambert

https://ebookmeta.com/product/microsoft-word-step-by-step-
office-2021-and-microsoft-365-1st-edition-joan-lambert/

Getting Started with Ethereum: A Step-by-Step Guide to


Becoming a Blockchain Developer 1st Edition Davi Pedro
Bauer

https://ebookmeta.com/product/getting-started-with-ethereum-a-
step-by-step-guide-to-becoming-a-blockchain-developer-1st-
edition-davi-pedro-bauer/

Moon 52 Things to Do in Los Angeles Local Spots Outdoor


Recreation Getaways 1st Edition Teena Apeles

https://ebookmeta.com/product/moon-52-things-to-do-in-los-
angeles-local-spots-outdoor-recreation-getaways-1st-edition-
teena-apeles/
Harlequin Romance April 2016 Box Set Rebecca Winters
Jennie Adams Cara Colter Kate Hardy

https://ebookmeta.com/product/harlequin-romance-april-2016-box-
set-rebecca-winters-jennie-adams-cara-colter-kate-hardy/

Never Silly Sophie 1st Edition Jessica Spencer

https://ebookmeta.com/product/never-silly-sophie-1st-edition-
jessica-spencer/

Python Distilled Developer s Library 1st Edition David


Beazley

https://ebookmeta.com/product/python-distilled-developer-s-
library-1st-edition-david-beazley/

Enjoyment of Music Essential Listening Fourth Edition


Forney

https://ebookmeta.com/product/enjoyment-of-music-essential-
listening-fourth-edition-forney/

Psychological War War Path 1 1st Edition Ryan Mundy

https://ebookmeta.com/product/psychological-war-war-path-1-1st-
edition-ryan-mundy/
Real Analysis and Infinity 1st Edition H Sedaghat

https://ebookmeta.com/product/real-analysis-and-infinity-1st-
edition-h-sedaghat/
Microsoft Visual C# Step by
Step
Tenth Edition

John Sharp
MICROSOFT VISUAL C# STEP BY STEP, TENTH EDITION
Published with the authorization of Microsoft Corporation by:
Pearson Education, Inc.

Copyright © 2022 by Agylia Group Ltd.

All rights reserved. This publication is protected by copyright, and


permission must be obtained from the publisher prior to any
prohibited reproduction, storage in a retrieval system, or
transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding
permissions, request forms, and the appropriate contacts within the
Pearson Education Global Rights & Permissions Department, please
visit www.pearson.com/permissions.

No patent liability is assumed with respect to the use of the


information contained herein. Although every precaution has been
taken in the preparation of this book, the publisher and author
assume no responsibility for errors or omissions. Nor is any liability
assumed for damages resulting from the use of the information
contained herein.

ISBN-13: 978-0-13-761983-2
ISBN-10: 0-13-761983-9

Library of Congress Control Number: 2022930224


ScoutAutomatedPrintCode

TRADEMARKS
Microsoft and the trademarks listed at http://www.microsoft.com on
the “Trademarks” webpage are trademarks of the Microsoft group of
companies. All other marks are property of their respective owners.

WARNING AND DISCLAIMER


Every effort has been made to make this book as complete and as
accurate as possible, but no warranty or fitness is implied. The
information provided is on an “as is” basis. The author, the publisher,
and Microsoft Corporation shall have neither liability nor
responsibility to any person or entity with respect to any loss or
damages arising from the information contained in this book or from
the use of the programs accompanying it.

SPECIAL SALES
For information about buying this title in bulk quantities, or for
special sales opportunities (which may include electronic versions;
custom cover designs; and content particular to your business,
training goals, marketing focus, or branding interests), please
contact our corporate sales department at
[email protected] or (800) 382-3419.

For government sales inquiries, please contact


[email protected].

For questions about sales outside the U.S., please contact


[email protected].

Editor-in-Chief: Brett Bartow

Executive Editor: Loretta Yates

Sponsoring Editor: Charvi Arora

Development Editor: Kate Shoup

Managing Editor: Sandra Schroeder

Senior Project Editor: Tracey Croom

Production Editor: Dan Foster


Copy Editor: Dan Foster

Indexer: Valerie Haynes Perry

Proofreader: Kim Wimpsett

Technical Editor: David Franson

Editorial Assistant: Cindy Teeters

Cover Designer: Twist Creative, Seattle

Compositor: Danielle Foster


Pearson’s Commitment to Diversity,
Equity, and Inclusion
Pearson is dedicated to creating bias-free content that reflects the
diversity of all learners. We embrace the many dimensions of
diversity, including but not limited to race, ethnicity, gender,
socioeconomic status, ability, age, sexual orientation, and religious
or political beliefs.
Education is a powerful force for equity and change in our world.
It has the potential to deliver opportunities that improve lives and
enable economic mobility. As we work with authors to create content
for every product and service, we acknowledge our responsibility to
demonstrate inclusivity and incorporate diverse scholarship so that
everyone can achieve their potential through learning. As the world’s
leading learning company, we have a duty to help drive change and
live up to our purpose to help more people create a better life for
themselves and to create a better world.
Our ambition is to purposefully contribute to a world where:
Everyone has an equitable and lifelong opportunity to succeed
through learning.
Our educational products and services are inclusive and represent
the rich diversity of learners.
Our educational content accurately reflects the histories and
experiences of the learners we serve.
Our educational content prompts deeper discussions with
learners and motivates them to expand their own learning (and
worldview).
While we work hard to present unbiased content, we want to hear
from you about any concerns or needs with this Pearson product so
that we can investigate and address them.
Please contact us with concerns about any potential bias at
https://www.pearson.com/report-bias.html.
Contents at a Glance
Acknowledgments
About the author
Introduction

PART I INTRODUCING MICROSOFT VISUAL C#


AND MICROSOFT VISUAL STUDIO 2022
CHAPTER 1 Welcome to C#
CHAPTER 2 Working with variables, operators, and expressions
CHAPTER 3 Writing methods and applying scope
CHAPTER 4 Using decision statements
CHAPTER 5 Using compound assignment and iteration statements
CHAPTER 6 Managing errors and exceptions

PART II UNDERSTANDING THE C# OBJECT


MODEL
CHAPTER 7 Creating and managing classes and objects
CHAPTER 8 Understanding values and references
CHAPTER 9 Creating value types with enumerations and structures
CHAPTER 10 Using arrays
CHAPTER 11 Understanding parameter arrays
CHAPTER 12 Working with inheritance
CHAPTER 13 Creating interfaces and defining abstract classes
CHAPTER 14 Using garbage collection and resource management
PART III UNDERSTANDING THE C# OBJECT
MODEL
CHAPTER 15 Implementing properties to access fields
CHAPTER 16 Handling binary data and using indexers
CHAPTER 17 Introducing generics
CHAPTER 18 Using collections
CHAPTER 19 Enumerating collections
CHAPTER 20 Decoupling application logic and handling events
CHAPTER 21 Querying in-memory data by using query expressions
CHAPTER 22 Operator overloading

PART IV BUILDING UNIVERSAL WINDOWS


PLATFORM APPLICATIONS WITH C#
CHAPTER 23 Improving throughput by using tasks
CHAPTER 24 Improving response time by performing asynchronous
operations
CHAPTER 25 Implementing the user interface for a Universal
Windows Platform app
CHAPTER 26 Displaying and searching for data in a Universal
Windows Platform app
CHAPTER 27 Accessing a remote database from a Universal
Windows Platform app

Index
Contents
Acknowledgments
About the author
Introduction

PART I INTRODUCING MICROSOFT VISUAL C#


AND MICROSOFT VISUAL STUDIO 2022

Chapter 1 Welcome to C#
Writing your first C# program
Beginning programming with the Visual Studio 2022
environment
Writing your first program using Visual Studio 2022
Using namespaces
Namespaces and assemblies
Commenting code
Creating a graphical application
Examining the Universal Windows Platform app
Adding code to the graphical application
Summary
Quick Reference

Chapter 2 Working with variables, operators, and


expressions
Understanding statements
Using identifiers
Identifying keywords
Using variables
Naming variables
Declaring variables
Specifying numeric values
Working with primitive data types
Unassigned local variables
Displaying primitive data type values
Using arithmetic operators
Operators and types
Examining arithmetic operators
Controlling precedence
Using associativity to evaluate expressions
Associativity and the assignment operator
Incrementing and decrementing variables
Prefix and postfix
Declaring implicitly typed local variables
Summary
Quick Reference

Chapter 3 Writing methods and applying scope


Creating methods
Declaring a method
Returning data from a method
Using expression-bodied methods
Calling methods
Specifying the method call syntax
Returning multiple values from a method
Applying scope
Defining local scope
Defining class scope
Overloading methods
Writing methods
Using the Visual Studio Debugger to step through
methods
Refactoring code
Nesting methods
Using optional parameters and named arguments
Defining optional parameters
Passing named arguments
Resolving ambiguities with optional parameters and
named arguments
Summary
Quick reference

Chapter 4 Using decision statements


Declaring Boolean variables
Using Boolean operators
Understanding equality and relational operators
Understanding conditional logical operators
Short-circuiting
Summarizing operator precedence and associativity
Pattern matching
Using if statements to make decisions
Understanding if statement syntax
Using blocks to group statements
Cascading if statements
Using switch statements
Understanding switch statement syntax
Following the switch statement rules
Using switch expressions with pattern matching
Summary
Quick reference

Chapter 5 Using compound assignment and iteration


statements
Using compound assignment operators
Writing while statements
Writing for statements
Writing do statements
Summary
Quick reference

Chapter 6 Managing errors and exceptions


Trying code and catching exceptions
Unhandled exceptions
Using multiple catch handlers
Catching multiple exceptions
Filtering exceptions
Propagating exceptions
Using checked and unchecked integer arithmetic
Writing checked statements
Writing checked expressions
Throwing exceptions
Using throw expressions
Using a finally block
Summary
Quick reference

PART II UNDERSTANDING THE C# OBJECT


MODEL

Chapter 7 Creating and managing classes and objects


Understanding classification
The purpose of encapsulation
Defining and using a class
Controlling accessibility
Working with constructors
Overloading constructors
Deconstructing an object
Understanding static methods and data
Creating a shared field
Creating a static field by using the const keyword
Understanding static classes
Static using statements
Anonymous classes
Summary
Quick reference

Chapter 8 Understanding values and references


Copying value type variables and classes
Understanding null values and nullable types
The null-conditional and null-coalescing operators
Using nullable types
Understanding the properties of nullable types
Using ref and out parameters
Creating ref parameters
Creating out parameters
How computer memory is organized
Using the stack and the heap
The System.Object class
Boxing
Unboxing
Casting data safely
The is operator
The as operator
The switch statement revisited
Summary
Quick reference

Chapter 9 Creating value types with enumerations and


structures
Working with enumerations
Declaring an enumeration
Using an enumeration
Choosing enumeration literal values
Choosing an enumeration’s underlying type
Working with structures
Declaring a structure
Understanding differences between structures and
classes
Discovering Diverse Content Through
Random Scribd Documents
of the name of Fulwood, by pushing rudely against him. Fulwood
expostulated with some degree of violence, upon which Fielding laid
his hand upon his sword. The pugnacious lawyer drew, and gave his
antagonist a severe wound in the body. Beau Fielding, who was then
a man of above fifty years of age, came forward, and uncovering his
breast, showed his bleeding wound to the public, to excite the
compassion of the fair sex; but, to his no small disappointment, a
burst of laughter broke forth from the audience. Fulwood,
emboldened by his success with Fielding, repaired to Lincoln’s-inn-
fields Theatre, where he picked up another quarrel with a Captain
Cusack, and then demanded satisfaction. They went into the fields,
and the lawyer was professionally despatched by the soldier, and left
dead on the ground.
Ball-rooms, masquerades, theatres, the open streets, the public
walks, bagnios, and coffee-houses, now became constant scenes of
strife and bloodshed; Covent-garden and Lincoln’s-inn-fields became
the rendezvous for deciding points of honour; and at all hours of the
night the clashing of swords might be heard by the peaceable
citizens returning home, at the risk of being insulted and ill treated
by the pretty fellows, and the beaux of the day. The system of
duelling pervaded all classes, and even physicians were wont to
decide their professional altercations at the point of the sword.
Doctors Mead and Woodward fought under the gate of Gresham
College; the latter slipped his foot and fell. “Take your life,”
exclaimed Dr. Mead. “Any thing but your physic,” replied the
prostrate Woodward.
Dr. Williams and Dr. Bennet, who had grossly abused each other in
print on matters relating to their profession, had recourse to blows,
when Dr. Bennet proposed a meeting to decide the business like
gentlemen. This proposal being rejected by Dr. Williams, Dr. Bennet
went the next morning to his house, and rapped at his door;
Williams, on opening it, discharged a pistol, loaded with swan-shot,
in the other’s breast. The wounded doctor retired across the way
towards a friend’s house, being pursued by Williams, who, very near
the door, fired a second pistol at him, and, whilst Bennet was
endeavouring to draw his sword, which had been pacifically adhering
fast to the scabbard, Williams ran him through the body. Bennet,
although in this dismal condition, was able to draw his rapier; and
praying to God to invigorate him to avenge his wrongs, he gave
Williams a home thrust, which entered the upper part of his breast
and came out at the shoulder blade, the sword snapping and part of
it remaining in the wound. Williams in retreating to his house fell
down dead, and Bennet lived but four hours after.
In the same year a duel was fought at Kinsale, in Ireland, which
originated from Ensign Sawyer, of O’Farrell’s regiment, having beaten
the servant of an officer of the same corps, for giving a slighting
answer to his wife. His master, Captain Wrey, had permitted his
servant to obtain a warrant for the assault, which the Ensign hearing
of, before he could be served with it, challenged the Captain to fight
him on the spot. The Captain, after having in vain remonstrated with
him upon the impropriety of his conduct, accompanied him to some
distance out of town, to gain some time for persuasion; when the
Ensign on a sudden drew his sword, and at the first onset wounded
the Captain in the left breast; at the second pass, in the left arm,
but on the third lounge the Captain ran him through the body, by
which he expired in two hours, first owning himself the aggressor,
and giving the Captain a kiss as a last farewell.
A fatal duel took place the same year between a Mr. Paul and a Mr.
Dalton. They had passed the evening together in the company of
some ladies, to one of whom Mr. Dalton was on the point of being
married. A quarrel arose, and they parted in anger, especially Mr.
Paul, who immediately after went to Mr. Dalton’s lodgings, and not
finding him at home, sent a message to him at a tavern, where he
understood he was spending the evening. Mr. Dalton, upon reading
it, hastened home, and in a few minutes after entered the room
where Mr. Paul was waiting for him. The servant, soon after hearing
a noise like fencing, ran up stairs; but before he could enter the
room, heard the street-door shut; the candles were out, and Mr. Paul
had fled. He found his master expiring, having a wound in the upper
part of his left breast. Upon this occasion the coroner’s jury returned
a verdict of wilful murder. Mr. Paul never submitted to his trial, and
was outlawed.
While personal meetings were then frequent, and often carried on
in the most dishonourable manner, general frays were not
uncommon. In 1717, after a levee, a large party of gentlemen were
assembled at the Royal Chocolate-house, in St. James’s-street.
Disputes at hazard produced a quarrel, which became general
throughout the room; a mêlée ensued, and as they all fought with
swords, three of the party were mortally wounded. The affray was
only terminated by the interference of a party of the Guards; who,
as entreaties and commands were of no avail, knocked the most
pugnacious of the combatants down with the but-end of their
muskets. A footman of one of the party (a Colonel Cunningham),
who was greatly attached to his master, rushed through the drawn
swords; and seizing him round the waist, actually carried him away.
In 1720, at twelve at night, about one hundred gentlemen were
engaged in a riot in Windmill-street with swords and canes, when
several of the party were desperately wounded. The watchmen
sought to interfere, but were knocked down and barbarously ill-
treated. At last a patrole of Horse Guards came up; and finding the
rioters obstinate, rode through them, cutting at them with their
swords. Some were killed, and several of them were so desperately
wounded that fears of their recovery were entertained. The quarrel
had begun between two chairmen. Such was the state of society in
London, and of its police, at that period.
A week after this outrageous breach of the peace, a Captain
Fitzgerald, and three young men, met a lady in the Strand, returning
from St. James’s in a sedan-chair. They stopped the chairmen, and
brutally attempted to force the lady out. The chairmen opposed
them; then they drew their swords, and demolished the vehicle. The
watchmen interfered, and one of them was run through the body,
and immediately expired.
Clubs were formed of those desperadoes, who assumed the name
of the “Bold Bucks,” and the “Hell-fires.” “Blind and Bold Love” was
the motto of the former association, the members of which,
according to a contemporary writer, “attempt females of their own
species promiscuously. Their own sisters fear their violence, and fly
their privacies.” Atheism was an indispensable qualification for
admission into their society, and their favourite dish for supper, at
the taverns they haunted, was called “A Holy Ghost Pie;” but their
chief house of rendezvous was a tavern near Somerset House,
where they usually assembled during Divine service with a loud band
of music.
Their excesses became so notorious, and proved such a public
grievance, that in 1721, a Royal proclamation was issued to suppress
those clubs, and about the same time a check was put to duelling by
the sentence of death passed on a Major Oneby, who thought it
advisable to baulk the executioner and the public curiosity by
committing suicide.
The following are the particulars of this very important case:—
Major Oneby was indicted in the year 1726, for the murder of Mr.
Gower, and a special verdict was found, stating that the prisoner
being in company with the deceased, and three other persons, at a
tavern, in a friendly manner, after some time began playing at
hazard; when Rich, one of the company, asked if any one would set
him three half crowns; whereupon the deceased, in a jocular
manner, laid down three halfpence, telling Rich he had set him three
pieces, and the prisoner at the same time set Rich three half crowns,
and lost them to him. Immediately after which, the prisoner, in an
angry manner, turned about to the deceased and said, “It was an
impertinent thing to set down halfpence, and that he was an
impertinent puppy for so doing;” to which the deceased answered,
“whoever called him so was a rascal.” Thereupon the prisoner took
up a bottle, and with great force threw it at the deceased’s head, but
did not hit him, the bottle only brushing some of the powder out of
his hair. The deceased, in return, immediately tossed a candlestick or
bottle at the prisoner, which missed him; upon which they both rose
up to fetch their swords, which were then hung up in the room, and
the deceased drew his sword, but the prisoner was prevented
drawing his by the company; the deceased thereupon threw away
his sword, and the company interposing, they sat down again for the
space of an hour.
At the expiration of that time, the deceased said to the prisoner,
“We have had hot words, and you were the aggressor, but I think we
may pass it over,” at the same time offering his hand to the prisoner,
who made for answer, “No, d—n you, I will have your blood.”
After which, the reckoning being paid, all the company, with the
exception of the prisoner, went out of the room to go home, and he
called to the deceased, saying, “Young man, come back, I have
something to say to you.” Whereupon the deceased returned into
the room, and immediately the door was closed, and the rest of the
company excluded; but they heard a clashing of swords, and the
prisoner gave the deceased his mortal wound. It was also found
that, on the breaking up of the company, the prisoner had his great
coat thrown over his shoulders, and that he received three slight
wounds in the fight; and that the deceased being asked upon his
death-bed whether he had received his wounds in a manner
amongst swordsmen called fair, answered “I think I did.” It was
further found that after the throwing of the bottle, there was no
reconciliation between the prisoner and the deceased.
Upon these facts all the judges were of opinion that the prisoner
was guilty of murder; he having acted upon malice and deliberation,
and not from sudden passion. The argument of the Chief Justice
went to show, that after the door had been shut the parties were
upon an equal footing in point of preparation before the fight began,
in which the mortal wound was given. The main point then, on
which the judgment turned, and so declared to be, was the evidence
of express malice, after the interposition of the company, and the
parties had all sat down again for an hour. Under these
circumstances the Court were of opinion that the prisoner had had
reasonable time for cooling; after which, upon an offer of
reconciliation from the deceased, he had made use of that bitter and
deliberate expression, “That he would have his blood;” and again,
the prisoner remaining in the room after the rest of the company
had retired, and calling back the deceased by the contemptuous
appellation of “young man,” on pretence of having something to say
to him, altogether showed such strong proof of deliberation and
coolness, as precluded the presumption of passion having continued
down to the time of the mortal stroke, and that there was no doubt
but that he had compelled Gower to defend himself.
It was also about this period that Addison and Steele, in the
Spectator and the Tatler, endeavoured to draw public attention to
this subject, and used both the power of persuasion and raillery to
discountenance the disgraceful practice. In No. 84 of the Spectator,
Steele wrote an essay against duelling, and in the character of
Spinamont he alluded to a meeting that had taken place between Sir
Cholmondeley Dering and Mr. Thornhill, when the former was killed.
Thornhill was acquitted of the charge of murder; but two months
after, he was stabbed by two men on Turnham-green, who
exclaimed as they struck him, “Remember Sir Cholmondeley Dering.”
In the 9th number of the Spectator, Addison commences his
remarks on duelling by describing the “Hum-Drum and Mum Clubs,”
and adds, “I cannot forbear mentioning a mischievous one that was
erected in the reign of Charles II, I mean the club of duellists, in
which none was to be admitted that had not fought his man. The
president of it was said to have killed half a dozen in single combat;
and as for the other members they took their seats according to the
number of their slain. There was likewise a side-table for such as
had only drawn blood, and shown a laudable ambition of taking the
first opportunity to qualify themselves for the first table. This club,
which consisted only of men of honour, did not continue long, most
of the members being put to the sword, or hanged, a little after the
institution.”
In a paper, No. 99, Addison relates the following anecdote:—“An
English peer[5] used to tell a pleasant story of a French gentleman
who visited him very early one morning; and after great professions
of respect, let him know that he had it in his power to oblige him,
which in short amounted to this, that he believed he could tell his
Lordship the person’s name who had jostled him as he came out of
the Opera; but before he would proceed, he begged his Lordship
that he would not deny him the honour of making him his second.
The English Lord, to avoid being drawn into a very foolish affair, told
him he was under particular engagements for his two next duels, to
a couple of particular friends. Upon which the gentleman
immediately withdrew, hoping his Lordship would not take it ill if he
meddled no further in an affair from whence he himself was to reap
no advantage.”
Steele himself, notwithstanding his efforts to discountenance
duelling, was drawn into a quarrel that very nearly proved fatal. At
that period he was an officer in the Coldstream Guards, when a
brother officer communicated to him his intention of calling out a
person who had offended him, but was dissuaded from this purpose
by the powerful arguments of Steele. Some of the other officers of
the regiment thought proper to spread a report that Steele had thus
interfered in the affair to skreen the offender from a merited
chastisement, thus compromising the honour of the person whom he
had offended. A challenge was therefore sent to Steele. He sought in
vain to avoid the meeting, but at last consented. Relying on his skill
in swordsmanship, he felt persuaded that he could chastise the
aggressor without endangering his life. The parties met, and Steele’s
buckle breaking as he was tightening his shoe, he urged this
accident to induce the challenger to desist, but to no purpose.
Swords were crossed, Steele parried several lounges, till at last, in
an attempt to disarm his antagonist, he ran him through the body.
After lingering some time in a hopeless state, Steele was delighted
to hear of his recovery.
Notwithstanding the vogue of duelling, in many instances, as in
the case of Steele, persons who were challenged endeavoured to
decline a meeting, and the following letter from an officer of the
Guards to a gentleman who had called him out, is an illustration of
the light in which private combat was even then viewed by men of
real honour:—
“Sir,—I reckon it my peculiar happiness that I can produce the
officers and soldiers who witnessed my behaviour at Fontenoy, as
evidence of my courage. You may endeavour, if you please, to
propagate my refusing your challenge, and brand me with
cowardice; but I am fully convinced that nobody will believe me
guilty, and every one will see that you are malicious. The cause in
which we quarrelled was a trifle: the blood of a soldier should be
reserved for nobler purposes. Love is blind, resentment mean, and
taste capricious; and it ought to be considered that murder, though
palliated by a false show of honour, is murder still, and calls for
vengeance.”
During the administration of Sir Robert Walpole the practice of
duelling was most fashionable, and of course frequently resorted to.
In the following letter to Mann, we find an illustration of the
manners of the day (1750).
“About ten days ago, at the new Lady Cobham’s assembly, Lord
Hervey was leaning over a chair talking to some women, and holding
his hat in his hand; Lord Cobham came up and spit in it—yes, spit in
it—and then, with a loud laugh, turned to Nugent, and said ‘Pay me
my wager.’ In short, he had laid a guinea that he committed this
absurd brutality, and that it was not resented. Lord Hervey, with
great temper and sense, asked if he had any further occasion for his
hat. ‘Oh, I see you are angry.’ ‘Not very well pleased.’ Lord Cobham
took the fatal hat and wiped it, and made a thousand foolish
apologies, and wanted to pass it off as a joke. Next morning he rose
with the sun, and went to visit Lord Hervey: he would not see him,
but wrote to the spitter (or, as he is now called. Lord Gob’em), to
say that he had grossly insulted him before company, but having
involved Nugent in it, he desired to know to which he was to address
himself for satisfaction. Lord Cobham made a most submissive
answer, and begged pardon both in his own and Nugent’s name.
Here it rested for a few days, till, the matter getting wind, Lord
Hervey wrote again to insist upon an explicit apology under Lord
Cobham’s own hand, with a rehearsal of the excuses that had been
made to him. This too was complied with, and the fair conqueror
showed all the letters. Nugent’s disgraces have not ended here. The
night of his having declaimed so furiously against Lord Sandwich, he
was standing by Lady Catherine Pelham at the masquerade, without
his mask. She was telling him some history of a mad dog (which I
believe she had bit herself). Young Leveson, the Duchess of
Bedford’s brother, came up, without his mask too, and looking at
Nugent, said, ‘I have seen a mad dog to-day, and a silly dog too.’ ‘I
suppose, Mr. Leveson, you have been looking in the glass.’ ‘No, I see
him now.’ Upon which they walked off together, but were prevented
from fighting (if Nugent would have fought), and were reconciled at
the sideboard. The former circumstance gave rise to a vulgar, but for
a time, a fashionable saw, ‘We spit in his hat on Thursday, and wipe
it off on Friday.’”
Walpole calls Lord Hervey “The fair conqueror,” from his great
effeminacy, which induced Lord Cobham, better known as Earl
Temple, to insult him in so gross a manner.
As the fashion of wearing swords gradually fell into desuetude,
pistols were brought into play, and the fatal duel between Lord
Byron and Mr. Chaworth was one of the last that took place with
side-arms.

DUEL OF LORD BYRON AND MR. CHAWORTH, 1765.

On the 26th of January, 1765, Lord Byron and several other


gentlemen dined together at the Star and Garter Tavern in Pall-mall.
The party were chiefly from the county of Nottingham, assembled in
a club, about seven in the evening. The conversation turned upon
the subject of game; upon this occasion Mr. Chaworth had a warm
argument with a gentleman seated next to him about the best
manner of preserving game. Lord Byron joined the conversation, and
gave as his opinion, that the best method was to take no care of it.
Mr. Chaworth differed in opinion, and thought it more advisable to
be strict with poachers. This drew on an altercation. Mr. Chaworth
asserted that there was not a hare in that part of the county which
was not preserved by him, or by Sir Charles Sedley. Upon which Lord
Byron offered a bet of 100l. that he had more game on a manor or
manors of his, than Mr. Chaworth had on any belonging to him. Mr.
Chaworth accepted the wager, and made a memorandum of it. Lord
Byron then observed, with some degree of warmth, and in a
sarcastic manner, “Sir Charles Sedley’s manors! where are his
manors!” To which Mr. Chaworth replied, with equal heat, “The
manors of Hucknel and Nuttall.” To which Lord Byron replied, “I
know no manors of Sir Charles Sedley.” Mr. Chaworth then observed
that the manor of Nuttall was his, and that he had purchased it from
his (Chaworth’s) family, and added, “If your Lordship wants any
further information about his manors, Sir Charles Sedley lives in
Dean-street, and your Lordship knows where to find me in Berkley-
square.”
After this altercation the party remained together for about an
hour in apparent good humour, and the conversation turned on
various subjects. About eight o’clock Mr. Chaworth left the room, and
asked a gentleman of the name of Douston, who was quitting it at
the same time, whether he had observed the dispute between him
and Lord Byron. This person replied, that he had heard part of it. On
which Chaworth asked him if he thought he had gone far enough; to
which Mr. D. replied that he thought he had gone too far, that it was
altogether a silly business, and neither of them should think any
more about it.
Shortly after Lord Byron left the room also, and met Mr. Chaworth,
when he stated that he wished to speak with him. He then called a
waiter, and asked if there were any room disengaged. The waiter
then showed them to an unoccupied room, and went in with a
candle, which was all the light, except a dull fire, that was in the
apartment. Lord Byron asked Mr. Chaworth whether it was to him or
to Sir Charles Sedley, that he was to have recourse on the disputed
subject. Mr. Chaworth then replied that it was to him, and that if he
had any thing further to say in the matter it might be advisable to
shut the door, which he immediately did; when turning round, he
perceived Lord Byron with his sword half drawn, who instantly
exclaimed, “Draw!” Mr. Chaworth immediately complied, and at the
first thrust his sword passed through Lord Byron’s waistcoat, and he
thought he had wounded him, when Lord Byron shortened his
sword, and gave him the fatal wound, observing at the same time
that he had as much courage as any man in England. A struggle
then took place between the parties, for when the waiter and the
landlord entered the room they were grasped in each others arms,
Mr. Chaworth holding his sword in his left hand, and Lord Byron
having his in his right hand. Chaworth gave up his sword readily, but
Lord Byron only surrendered his with reluctance. Hawkrup, the
surgeon, was immediately sent for, and pronounced the wound to be
mortal. The sword had entered about an inch on the left side of the
naval, and passing obliquely upwards, had made its exit about five
or six inches higher on the left side of the back, and in its passage
had made a large opening in the bottom of the stomach, wounded
one of the small intestines, and had passed through the diaphragm.
It appears that when the sword of Mr. Chaworth passed through
the waistcoat of his antagonist, he expressed his apprehension that
he had seriously wounded him. Now, under such an apprehension, it
is probable that he was thrown off his guard, when Lord Byron
immediately shortened his sword and ran him through the body, the
unfortunate gentleman endeavouring to parry the thrust with his left
hand, and seizing the gripe of his sword and struggling for it, still
saying that he hoped his Lordship was not seriously hurt; it was then
that Lord Byron exclaimed, “That he hoped he would acknowledge
that he was as brave a man as any other in the kingdom.”
Writhing under the agonies of his wound, Chaworth several times
declared, that although he well knew that he was in immediate
danger of death, and pained and distressed as he then was, he had
rather be in his present situation, than live under the misfortune of
having killed another person; and when questioned on the nature of
the quarrel, he expressed his conviction that it might have been
easily made up. When asked by one of his relations, Mr. Leveriz, if
the business had been fair, he remained silent. He only observed
soon after, that when, after closing the door, he turned round, he
perceived that Lord Byron’s sword was half drawn; knowing his man,
he drew his own as quickly as he could, and had the first pass at
him. He further added, that he did not believe that Lord Byron
intended fighting him when they entered the room, but seeing him
up by the door, with scarcely any light in the room, he believed he
thought he had him at advantage.
Lord Byron, in his defence, stated that the deceased had treated
him during the altercation “in a slighting and contemptuous manner,”
stating that he had more game on five acres of his manor, than was
on all his lordship’s estates. He further stated, that on leaving the
club-room he met Chaworth on the stairs, who asked him “if he had
any commands for him,” to which he replied, “I should be glad of an
opportunity of speaking a few words to you.” The door being closed,
Lord Byron asked him “How am I to take those words you used, as
an intended affront from Sir Charles Sedley or yourself,” to which,
according to the survivor’s statement, Chaworth replied, “Your
Lordship may take them as you please, either as an affront or not,
and I imagine this room is as fit a place as any other to decide the
affair in.” Lord Byron admitted, that at the very moment when his
antagonist received his mortal wound, he exclaimed, “I am afraid I
have killed your Lordship!” while at the same time “he put his left
hand to his belly, and Lord Byron observing that blood was flowing,
expressed his fear that he had seriously wounded him, when he
went to pull the bell for assistance, Mr. Chaworth saying, “My Lord,
all I have to say is, that you have behaved like a gentleman.”
The House of Lords found William, Lord Byron, “not guilty of the
felony of murder, but of manslaughter,” and his Lordship, claiming
the benefit of the statute of Edward VI, was discharged, paying his
fees.
This unfortunate duel leads to many important reflections. It
appears that the parties were sober, that no previous ill-will existed
between them; but that the vanity of both had been hurt by
reflections on their manorial possessions; and the subject of game
has ever been, and still continues to be, a sore one amongst country
gentlemen. To fight without seconds has at all times been
considered a murderous transaction; since no evidence can be
produced to prove that the foulest treachery may not have been
perpetrated. Chaworth declined (most probably from a high sense of
honour) accusing his antagonist of foul play; but he at the same
time, on his death-bed, also declined admitting that there had been
fair play. Lord Byron stated, that having parried Mr. Chaworth’s first
thrust, he made a second, which he also parried; and that then
finding himself with his back against the table, with great
disadvantage of light, he endeavoured to shift a little more to the
right hand, which unavoidably brought him nearer to his antagonist,
when they both made a thrust at the same time, Mr. C.’s sword
passing against his ribs, and cutting his waistcoat and shirt for
upwards of eight inches, and he supposes that it was then that Mr.
C. received the unlucky wound.
It is impossible to form an opinion on this event, as to the fairness
of the duel; it only tends to show, that any fatal meeting without
seconds, should be visited with such severity as to prevent the
probability of a recurrence.
In 1762, was fought the celebrated duel between Earl Talbot and
John Wilkes. The dispute had originated in words used in the 12th
number of the North Briton, on the 21st August, which conveyed
reflections injurious to Earl Talbot, when Wilkes wrote the following
letter to Colonel Berkeley (afterwards Lord Bottetourt):—
“Winchester, Sept. 30, 1762.
“Sir,
“Lord Talbot, by your message, has at last brought this most
important question to the precise point where my first answer to his
Lordship fixed it, if he preferred that. As you have only seen the two
last letters, I must entreat you to cast your eye over those
preceding; because I apprehend they will justify an observation or
two I made this morning, when I had the honour of paying my
respects to you at camp. Be assured, that if I am between heaven
and earth, I will be on Tuesday evening at Telbury’s, the Red Lion, at
Bagshot, and on Wednesday morning will play this duel with his
Lordship.
“It is a real satisfaction to me that his Lordship is to be
accompanied by a gentleman of Colonel Berkeley’s worth and
honour.
“This will be delivered to you by my Adjutant, who attends me at
Bagshot. I shall not bring any servant with me, from the fear of any
of the parties being known. My pistols only, or his Lordship’s, at his
option, shall decide this point.
“I beg the favour of you to return me the letters, as I mean to
leave Winchester this evening. I have Lord Bruce’s leave of absence
for ten days.
“I am, &c.
“John Wilkes.
“I hope we may make a partie quarrée for supper on Tuesday, at
Bagshot.”
To this lively letter the following reply was sent:—
“Camp, near Winchester, Sept. 30, 1762.
“Sir,
“I have sent all the letters, and shall depend upon the pleasure of
supping with you at Telbury’s, the Red Lion, at Bagshot, Tuesday
evening. My servant will attend me, as the going alone would give
room for suspicion; but you may depend upon his following your
directions at Bagshot, and that he shall not be seen where you
would not have him. I am much obliged by your favourable opinion,
and am, &c.
“H. Berkeley.”
“To Colonel Wilkes.”
In a letter to Earl Temple, Wilkes gives the following account of
this singular meeting:—
“Red Lion, at Bagshot,
”Tuesday, 10 at night, Oct. 5, 1762.
“My Lord,
“I had the honour of transmitting to your Lordship copies of seven
letters which passed between Lord Talbot and me. As the affair is
now over, I inclose an original letter of Colonel Berkeley’s, with a
copy of mine previous to it, which fixed the particulars of our
meeting, and therefore remained a secret, very sacredly kept by the
four persons concerned.
“I came here at three this afternoon, and about five was told that
Lord Talbot and Colonel Berkeley were in the house. Lord Talbot had
been here at one, and was gone again, leaving a message, however,
that he would soon return. I had continued in the room where I was
at my first coming for fear of raising any suspicion. I sent a
compliment to Colonel Berkeley, and that I wished to see him; he
was so obliging as to come to me directly. I told him that I supposed
we were to sup together with Lord Talbot, whom I was ready to
attend as became a private gentleman, and that he and Mr. Harris
(my Adjutant), as our seconds, would settle the business of the next
morning, according to my letter to him from Winchester, and his
answer. Berkeley said that his Lordship wished to finish the business
immediately. I replied, that the appointment was to sup together
that evening and to fight in the morning; that in consequence of
such an arrangement, I had, like an idle man of pleasure, put off
some business of real importance, which I meant to settle before I
went to bed. I added, that I came from Medmenham Abbey, where
the jovial monks of St. Francis had kept me up till four in the
morning. That the world would therefore conclude that I was drunk,
and form no favourable opinion of his Lordship from a duel at such a
time; that it more became us both to take a cool hour of the next
morning, and as early a one as was agreeable to his Lordship.
Berkeley said that he had undertaken to bring us together, and as
we were both now at Bagshot, he would leave us to settle our own
business. He then asked me if I would go with him to his Lordship. I
said I would any moment he pleased. We went directly, with my
Adjutant.
“I found his Lordship in an agony of passion. He said that I had
injured him; that he was not used to be injured or insulted. What did
I mean? Did I, or did I not, write the North Briton of August the
21st, which affronted his honour? He would know; he insisted on a
direct answer; here were his pistols. I replied, that he would soon
use them; that I desired to know by what right his Lordship
catechised me about a paper that did not bear my name; that I
should never resolve the question to him till he made out the right of
putting it; and that if I could have entertained any other idea, I was
too well bred to have given his Lordship and Colonel Berkeley the
trouble of coming to Bagshot. I observed that I was a private English
gentleman, perfectly free and independent, which I held to be a
character of the highest dignity; that I obeyed with pleasure a
gracious sovereign, but would never submit to the arbitrary dictates
of a fellow-subject, a lord steward of his household, my superior
indeed in rank, fortune, and abilities, but my equal only in honour,
courage, and liberty. His Lordship then asked me if I would fight him
that evening. I said that I preferred the next morning, as it had been
settled before, and gave my reasons. His Lordship replied that he
insisted on finishing the affair immediately. I told him that I should
very soon be ready; that I did not mean to quit him, but would
absolutely first settle some important business relative to the
education of my only daughter, whom I tenderly loved; that it would
take up but very little time; and that I would immediately decide the
affair in any way he chose, for I had brought both sword and pistols.
I rang the bell for pen, ink, and paper, desiring his Lordship to
conceal his pistols, that they might not be seen by the waiters. He
soon after became half frantic, and used a thousand indecent
expressions, that I should be hanged, damned, &c., &c. I said that I
was not to be frightened, nor in the least affected by such violence;
that God had given me a firmness and spirit equal to his Lordship’s,
or any man’s; that cool courage should always mark me; and that it
would be seen how well bottomed he was.
“After the waiter had brought pen, ink, and paper, I proposed that
the door of the room should be locked, and not opened till our
business was decided. His Lordship, on this proposition, became
quite outrageous; declared that this was mere butchery, and that I
was a wretch who sought his life. I reminded him that I came there
on a point of honour to give his Lordship satisfaction; that I
mentioned the circumstance of shutting the door only to prevent all
possibility of interruption; and that I would, in every circumstance,
be governed, not by the turbulence of the most violent temper I had
ever seen, but by the calm determination of our two seconds, to
whom I implicitly submitted. His Lordship then asked me if I would
deny the paper. I answered that I would neither own nor deny it; if I
survived, I would afterwards declare, but not before.
“Soon after he grew a little cooler, and in a soothing tone of voice,
said, ‘I have never, I believe, offended Mr. Wilkes, why has he
attacked me? He must be sorry to see me unhappy.’ I asked him
upon what grounds his Lordship imputed the paper to me? That Mr.
Wilkes would justify any paper to which he had put his name, and
would equally assert the privilege of not giving any answer whatever
about a paper to which he had not; that that was my undoubted
right, which I was ready to seal with my blood.
“He then said he admired me exceedingly, really loved me, but I
was an unaccountable animal—such parts! But would I kill him who
had never offended me? &c., &c. We had after this a good deal of
conversation about the Bucks’ Militia and the day his Lordship came
to see me on Wycombe Heath, before I was colonel. He soon after
flamed out again, and said to me, ‘You are a murderer, you want to
kill me, but I am sure I shall kill you, I know I shall, by G—d! If you
will fight, if you will kill me, I hope you will be hanged. I know you
will.’ I asked if I was first to be killed and afterwards to be hanged?
That I knew his Lordship fought me with the King’s pardon in his
pocket, and I fought him with a halter about my neck. That I would
fight him for all that, and if he fell I should not tarry here a moment
for the tender mercies of such a ministry; but would directly proceed
to the next stage, where my valet waited for me, from thence I
would make the best of my way to France, as men of honour were
sure of protection in that country. He then told me that I was an
unbeliever, and wished to be killed. I could not help smiling at this,
and observed that we did not meet at Bagshot to settle articles of
faith, but points of honour; that, indeed, I had no fear of dying, but
I enjoyed life as much as any man; that I am as little subject to be
gloomy or even peevish, as any Englishman whatever; that I valued
life and the fair enjoyments of it so much, I would never quit it with
my own consent, except on a call of honour.
“I then wrote a letter to your Lordship, respecting the education of
Miss Wilkes, and gave you my poor thanks for the steady friendship
with which you have so many years honoured me. Colonel Berkeley
took the care of the letter, and I have since desired him to send it to
Stowe; for the sentiments of the head at such a moment are beyond
all politics, and indeed everything else, except such virtue as Lord
Temple’s.
“When I had sealed my letter, I told his Lordship I was entirely at
his service, and I again desired that we might decide the affair in the
room, because there could not be a possibility of interruption; but he
was quite inexorable. He then asked me how many times we should
fire. I said, that I left it to his choice. I had brought a flask of
powder and a bag of bullets. Our seconds then charged the pistols
which my Adjutant had brought. They were large horse-pistols. It
was agreed that we should fire at the word of command, to be given
by one of our seconds. They tossed up, and it fell to my Adjutant to
give the word.
“We then left the room, and walked to a garden at some distance
from the house. It was near seven, and the moon shone brightly. We
stood about eight yards distant, and agreed not to turn round before
we fired, but to continue facing each other. Harris gave the word.
Both our fires were in very exact time, but neither took effect.
“I walked up immediately to his Lordship, and told him, that now I
avowed the paper. His Lordship paid me the highest encomiums on
my courage, and said, he would declare everywhere that I am the
noblest fellow God had ever made. He then desired that we might
now be good friends, and retire to the inn to drink a bottle of claret
together, which we did with great good humour and much laugh.
“His Lordship afterwards went to Windsor, Colonel Berkeley and
my Adjutant to Winchester, and I continue here until to-morrow
morning, waiting the return of my valet, to whom I have sent a
messenger. Berkeley told me he was grieved at his Lordship’s
passion, and admired my coolness and courage beyond his farthest
idea,—that was his expression.
“I am, my Lord, &c.
“John Wilkes.”

According to our modern notions of duelling, in this curious


transaction one might be disposed to think that neither of the parties
was particularly anxious to fight. That Wilkes should have wished to
sup in company with the person whom he had offended, the night
before the duel, would lead one to fancy that he contemplated the
possibility of a reconciliation. On the other hand, Lord Talbot, by his
conduct, which was most ungentlemanly and outrageous, seemed
disposed to bully Wilkes into a concession; and both parties talked of
killing, with a view to terrify each other. From the well-known
character of Wilkes, no one could doubt his courage; but his refusing
to acknowledge himself the writer of the offensive article, which he
after the duel admitted to have been his, was a shallow act, that
nothing could have justified but the insulting manner in which Lord
Talbot put the question to him; and most assuredly his Lordship had
the worst of the affair, since he was satisfied with a shot returned,
although Wilkes acknowledged himself the writer of the insulting
paragraph. The frequency of the duels that occurred in those days
does not appear to have given them, generally speaking, a character
of much delicacy or punctilious honour; and they seem to have been
the result of fashion more than of feeling.
In 1763 Wilkes got involved in another duel, with Mr. Martin,
Secretary to the Treasury. The North Briton, of which he was the
editor, with its usual acrimony against the members of the
administration, had introduced some characteristic sketches,
supposed to allude to Samuel Martin, member of Parliament for
Camelford, and Secretary to the Treasury, and afterwards the hero in
Churchill’s poem, “The Duellist.” The following was the offensive
paragraph:—
“The secretary of a certain board, and a very apt tool of ministerial
persecution, who, with a snout worthy of a Portuguese inquisitor, is
hourly looking out for carrion in office, to feed the maw of the
insatiable vulture, imo, etiam in senatum venit, notat et designat
unumquemque nostrûm, he marks us, and all our innocent families,
for beggary and ruin. Neither the tenderness of age, nor the
sacredness of sex, is spared by the cruel Scot.”
In a further number notice is again taken “of the most
treacherous, base, selfish, mean, abject, low-lived, and dirty fellow,
that ever wriggled himself into a secretaryship.”
In consequence of that paragraph, which Mr. Martin applied to
himself, he made use of very insulting language in the House of
Commons, when speaking of the North Briton, upon which Wilkes
sent him the following letter;—

“Great George Street, Nov. 16, 1763.


“Sir,
“You complained yesterday before five hundred gentlemen, that
you had been stabbed in the dark by the North Briton. But I believe
you were not so much in the dark as you affected and chose to be.
Was the complaint made before so many gentlemen on purpose that
they might interpose? To cut off every pretence of this kind, as to
the author, I whisper in your ear, that every passage of the North
Briton in which you have been named or alluded to, was written by
“Your humble servant,
“John Wilkes.”

To this letter Mr. Martin returned the following answer:—

“Arlington Street, Nov. 16, 1763.


“Sir,
“As I said in the House of Commons yesterday, that the writer of
the North Briton, who had stabbed me in the dark, was a cowardly
as well as a malignant scoundrel, and your letter of this morning’s
date acknowledges that every passage of the North Briton in which I
have been named, or even alluded to, was written by yourself, I
must take the liberty to repeat, that you are a malignant and
infamous scoundrel, and that I desire to give you an opportunity of
showing me whether the epithet cowardly was rightly applied or not.
I desire that you may meet me in Hyde Park immediately, with a
brace of pistols each, to determine our difference. I shall go to the
ring in Hyde Park, with my pistols, so concealed that nobody may
see them, and I will wait in expectation of you one hour. As I shall
call on my way at your house to deliver this letter, I propose to go
from thence directly to the ring in Hyde Park, from whence we may
proceed, if it be necessary, to any more private place. And I mention
that I shall wait an hour, in order to give you the full time to meet
me.
“I am, sir, your humble servant,
“Samuel Martin.”

When the parties met in Hyde Park, they walked together a little
while to avoid some company which seemed coming up to them.
They brought each a pair of pistols. When they were alone, the first

You might also like