73057164
73057164
com
https://ebooknice.com/product/microsoft-blazor-building-web-
applications-in-net-6-and-beyond-third-edition-36528582
OR CLICK HERE
DOWLOAD EBOOK
ebooknice.com
ebooknice.com
ebooknice.com
https://ebooknice.com/product/microsoft-blazor-2nd-edition-50195208
ebooknice.com
(Ebook) Building Modern Web Applications with ASP.NET Core
Blazor: Learn how to use Blazor to create powerful,
responsive, and engaging web applications by Brian Ding
ISBN 9789355518798, 935551879X
https://ebooknice.com/product/building-modern-web-applications-with-
asp-net-core-blazor-learn-how-to-use-blazor-to-create-powerful-
responsive-and-engaging-web-applications-52198310
ebooknice.com
ebooknice.com
ebooknice.com
ebooknice.com
ebooknice.com
Microsof t
Blazor
Building Web Applications in .NET 6 and
Beyond
—
Third Edition
—
Peter Himschoot
Microsoft Blazor
Building Web Applications in
.NET 6 and Beyond
Third Edition
Peter Himschoot
Microsoft Blazor: Building Web Applications in .NET 6 and Beyond
Peter Himschoot
Melle, Belgium
Introduction����������������������������������������������������������������������������������������������������������xxiii
iii
Table of Contents
iv
Table of Contents
v
Table of Contents
vi
Table of Contents
vii
Table of Contents
ix
Table of Contents
x
Table of Contents
Chapter 12: Building Real-Time Applications with Blazor and SignalR��������������� 449
What Is SignalR?����������������������������������������������������������������������������������������������������������������������� 449
How Does SignalR Work?���������������������������������������������������������������������������������������������������� 449
Building a WhiteBoard Application�������������������������������������������������������������������������������������������� 450
Creating the WhiteBoard Solution���������������������������������������������������������������������������������������� 450
Implementing the Mouse Handling Logic���������������������������������������������������������������������������� 453
Painting the Segments on the Board����������������������������������������������������������������������������������� 455
Adding a SignalR Hub on the Server����������������������������������������������������������������������������������������� 458
Implementing the BoardHub Class�������������������������������������������������������������������������������������� 458
xii
Table of Contents
xiii
Table of Contents
xiv
Table of Contents
xv
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 633
xvi
About the Author
Peter Himschoot works as a lead trainer, architect,
and strategist at U2U. He has a wide interest in software
development that includes applications for the Web,
Windows, and mobile devices. He has trained thousands of
developers, is a regular speaker at international conferences,
and has been involved in many web and mobile
development projects as a software architect. He has been
a Microsoft Regional Director (from 2003 to 2019) and co-
founded the Belgian Visual Studio User Group (VISUG) in
2006, which is a group of trusted advisors to developer and
IT professional audiences and to Microsoft.
xvii
About the Technical Reviewer
Gerald Versluis (@jfversluis) is a software engineer at
Microsoft from the Netherlands. With years of experience
working with Azure, ASP.NET, Xamarin (now .NET MAUI),
and other .NET technologies, he has been involved in
numerous projects and has been building several real-world
apps and solutions.
Not only does he like to code, but he is also passionate
about spreading his knowledge – as well as gaining some in
the bargain. Gerald involves himself in speaking, providing
training sessions, writing blogs or articles, recording videos for his YouTube channel,
and contributing to open source projects in his spare time.
Twitter: @jfversluis
Website: https://jfversluis.dev
xix
Acknowledgments
When Jonathan Gennick from Apress asked me if I would be interested in writing a book
on Blazor, I felt honored and of course I agreed that Blazor deserves a book. Writing a
book is a group effort, so I thank Jonathan Gennick and Jill Balzano for giving me tips
on styling and writing this book, and I thank Gerald Versluis for doing the technical
review and pointing out sections that needed a bit more explaining. I also thank Magda
Thielman and Lieven Iliano from U2U, my employer, for encouraging me to write
this book.
I thoroughly enjoyed writing this book, and I hope you will enjoy reading and
learning from it.
Second Edition
As the first edition of Blazor Revealed was published (using pre-release software), the
Blazor team had made a bunch of changes to the razor syntax, stopping my examples
in the first edition of Blazor Revealed from working. Now that Blazor has been released
and is completely official (YEAH!!!!), the time has come to publish an updated version of
Blazor Revealed, now renamed as Microsoft Blazor.
Should you get stuck with an example, I invite you to consult the accompanying code
samples for comparison purposes.
Third Edition
I wrote the third edition of Microsoft Blazor using the previews of .NET 6 to get this book
in your hands right after the official release of .NET 6. This of course means that the
last-minute changes made in October 2021 could not make it to this book. However,
I have set up a repository in GitHub where you can find last-minute additions and errata
at https://github.com/PeterHimschoot/microsoft-blazor-book-3, including every
sample and exercise using the latest version of .NET.
xxi
Introduction
Full Stack Web Development with C#
Building modern Single-Page Application websites today typically means writing
JavaScript on the client and C# on the server when you are using the Microsoft
development stack. But with Blazor, you can build everything using C# and reuse the
knowledge and experience you gained with .NET. Porting existing C# applications like
WinForms to the Web does not involve translating some of your logic to JavaScript; you
can again reuse most of this code, resulting in less testing and bugs.
Practical Development
I wrote this book with practice in mind, so sit down next to your computer and follow
along with the examples; the best way to learn is to just do things with Blazor. I did my
best to make the code samples easy to read, but this means breaking lines of code to fit
nicely on the page. When in doubt, you can always consult the included code, which
you can download from the book's product page, located at www.apress.com/{{ISBN}}.
You can find last-minute additions and errata at https://github.com/PeterHimschoot/
microsoft-blazor-book-3, including every sample and exercise using the latest version
of .NET.
xxiii
CHAPTER 1
Introduction
to WebAssembly
and Blazor
I was attending the Microsoft Most Valued Professional and Regional Directors summit
2018 where we were introduced to Blazor for the first time by Steve Sanderson and
Daniel Roth. And I must admit I was super excited about Blazor! Blazor is a framework
that allows you to build Single-Page Applications (SPAs) using C# and allows you to run
any standard .NET library in the browser. Before Blazor, your options for building a SPA
were Angular, React, Vue.js (and others) using JavaScript, or one of the other higher-
level languages like TypeScript (which gets compiled into JavaScript anyway). In this
introduction, we will look at how browsers are now capable of running .NET assemblies
in the browser using WebAssembly and Blazor.
1
© Peter Himschoot 2022
P. Himschoot, Microsoft Blazor, https://doi.org/10.1007/978-1-4842-7845-1_1
Chapter 1 Introduction to WebAssembly and Blazor
2
Chapter 1 Introduction to WebAssembly and Blazor
and Vue.js. All of them are using JavaScript or higher-level languages like TypeScript
which gets transpiled into JavaScript.
Transpiling will take one language and convert it into another language. This is very
popular with TypeScript which gives you a modern high-level typed language. You need
JavaScript to run it in a browser, so TypeScript gets “transpiled” into JavaScript.
This process takes a lot of effort because JavaScript needs to be downloaded into
the browser, where it gets parsed, then compiled into bytecode, and then Just-In-Time
converted into native code. So how can we make this process even faster?
The second browser war is all about JavaScript performance.
3
Chapter 1 Introduction to WebAssembly and Blazor
Introducing WebAssembly
WebAssembly allows you to take the parsing and compiling to the server, before your
users even open up their browser. With WebAssembly, you compile your code in a
format called WASM (an abbreviation of WebASseMbly), which gets downloaded by the
browser where it gets Just-In-Time compiled into native code as in Figure 1-2.
Open your browser and open https://earth.google.com. This should take you to
the Google Earth app written in WebAssembly as shown in Figure 1-3. Play around with
this a little bit and you will see that this application has excellent performance, but the
initial load takes a fair amount of time because it needs to download the whole WASM
application’s code.
4
Chapter 1 Introduction to WebAssembly and Blazor
5
Chapter 1 Introduction to WebAssembly and Blazor
6
Chapter 1 Introduction to WebAssembly and Blazor
As WebAssembly will become more and more important, we will see other browsers
follow suit, but don’t expect Internet Explorer to support WASM.
7
Chapter 1 Introduction to WebAssembly and Blazor
This is the approach currently taken by Blazor. In the beginning, Blazor used the
Mono runtime, but they have now built their own .NET Core runtime for WebAssembly.
But Blazor is not the only one taking this approach. For example, there is the Ooui
project which allows you to run Xamarin.Forms applications in the browser. The
disadvantage of this is that it needs to download a lot of .NET assemblies. This can be
solved by using tree shaking algorithms which remove all unused code from assemblies.
We will look at this in Chapter 15.
Note Each code sample has been formatted for readability, sometimes splitting
lines where this is not necessary and using less indentation. I leave it to you how
you decide to format your code.
8
Chapter 1 Introduction to WebAssembly and Blazor
@page "/counter"
<h1>Counter</h1>
@code {
private int currentCount = 0;
This file gets compiled into a .NET class (you’ll find out how later in this book)
which is then executed by the Blazor engine. The result of this execution is a tree-
like structure called the render tree. The render tree is then sent to JavaScript which
updates the DOM to reflect the render tree (creating, updating, and removing HTML
elements and attributes). Listing 1-1 will result in h1, p (with the contents set to the
value of currentCount), and button HTML elements. When you interact with the
page, for example, when you click the button, this will trigger the button’s click event
which will invoke the IncrementCount method from Listing 1-1. The render tree is
then regenerated, and any changes are sent again to JavaScript which will update the
DOM. This process is illustrated in Figure 1-6.
9
Chapter 1 Introduction to WebAssembly and Blazor
This model is very flexible. It allows you to build Progressive Web Apps, and your
app can be embedded in Electron desktop applications of which Visual Studio Code is a
prime example.
Blazor Server
At the August 7, 2018, ASP.NET community standup (www.youtube.com/watch?v=7Eh_
l7jEcCo), Daniel Roth introduced a new execution model for Blazor now called Blazor
Server. In this model, your Blazor site is running on the server resulting in a way smaller
download for the browser.
We just saw that Blazor WebAssembly builds a render tree using the .NET runtime
running in the browser which then gets sent to JavaScript to update the DOM. With
Blazor Server, the render tree is built on the server using regular .NET and then gets
serialized to the browser using SignalR (we will look at SignalR in a later chapter).
JavaScript in the browser then deserializes the render tree to update the DOM. Pretty
similar to the Blazor WebAssembly model. When you interact with the site, events get
serialized back to the server which then executes the .NET code, updating the render
tree, and the changes get serialized back to the browser. I’ve illustrated this process in
Figure 1-7. The big difference is that there is no need to send the .NET runtime and your
Blazor assemblies to the browser. And the programming model stays the same! You can
switch Blazor Server-side and Blazor WebAssembly with just a couple of small changes
to your code.
10
Chapter 1 Introduction to WebAssembly and Blazor
11
Chapter 1 Introduction to WebAssembly and Blazor
• .NET APIs: Because you are running your .NET code on the server,
you can use all the .NET APIs you would use with regular ASP.NET
Core MVC applications, for example, accessing the database directly.
Do note that doing this will stop you from quickly converting it into
a client-side application. You can limit this by writing service classes
and using dependency injection to inject different implementations
depending on the environment your components are hosted in.
• Server scalability: All your .NET code runs on the server, so if you have
thousands of clients, your server(s) will have to handle all the work. Not
only that, Blazor uses a stateful model which will require you to keep track
of every user’s state on the server. So your server will need more resources
than with Blazor WebAssembly which can use a stateless model.
Note I learned an important lesson from the first edition of this book: never
underestimate the speed at which Microsoft innovates! All code samples in the
first edition of Blazor Revealed became invalid quite rapidly. I do not expect this
to happen again with this edition since it is based on the Release To Manufacture
(RTM) version of Blazor. If something does not work, simply consult the sources
that come with this book. I will keep these up to date. Promise!
12
Chapter 1 Introduction to WebAssembly and Blazor
The source code for this book is available on GitHub via the book’s product page,
located at www.apress.com/ISBN.
dotnet --version
Output should indicate that you installed the correct version. The version number
should be at least 6.0.
Should the command’s output show an older version, you will need to download
and install a more recent version of .NET SDK. These can run side by side so you will not
break other .NET projects doing this.
13
Chapter 1 Introduction to WebAssembly and Blazor
Run the installer and make sure that you install the ASP.NET and web development
role as shown in Figure 1-8.
After installation, run Visual Studio from the Start menu. Then open the Help menu
and select About Microsoft Visual Studio. The About Microsoft Visual Studio dialog
window should specify at least version 17.0.0 as illustrated in Figure 1-9.
You can search for extensions, so start with C# which is the first extension from
Figure 1-11. This extension will give you IntelliSense and debugging for the C#
programming language and .NET assemblies. You will probably get a newer version
listed, so take the latest.
Click Install.
15
Chapter 1 Introduction to WebAssembly and Blazor
You will see four columns. The first shows the template’s description, the second
column displays the name, the third lists the languages for which the template is
available, and the last shows the tags, a kind of group name for the template. Among
those listed are the following of interest:
With Blazor projects, you have a couple of choices. You can create a standalone
Blazor project (using the blazorwasm template) that does not need server-side code. This
kind of project known as Blazor WebAssembly has the advantage that you can simply
deploy it to any web server which will function as a file server, allowing browsers to
download your site just like any other site. We will look at deployment in a later chapter.
Or you can create a hosted project (adding the --hosted option) with client, server,
and shared code. This kind of Blazor WebAssembly project will require you to host it
where there is .NET Core support because you will execute code on the server as well, for
example, to retrieve data from a database.
The third option is to run all Blazor code on the server (using the blazorserver
template). In this case, the browser will use a SignalR connection to receive UI updates
from the server and to send user interaction back to the server for processing.
16
Chapter 1 Introduction to WebAssembly and Blazor
In this book, we will use the second option (Blazor WebAssembly hosted on ASP.NET
MVC Core) most of the time, but the concepts you will learn in this book are the same
for all three options. You can even develop for Blazor WebAssembly and Blazor Server
at the same time! Why? Because debugging support for Blazor WebAssembly is limited,
so you develop with Blazor Server using all debugger features you know and love. But
you can test everything with Blazor WebAssembly ensuring you can run everything in
the browser later. This is the way I like to work. However, to pull this off, you need some
experience with Blazor first, so keep reading.
This command will take a little while because it will download a bunch of
NuGet packages from the Internet. When the command is ready, you can build your
project using
cd MyFirstBlazor
dotnet build
cd MyFirstBlazor/Server
dotnet run
This will show you some output, including the URL of the Blazor application:
Building...
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[14]
17
Chapter 1 Introduction to WebAssembly and Blazor
Open your browser on this address (here https://localhost:5001), and you are
ready to play!
Click Next.
Name your project MyFirstBlazor, choose the location where the project should be
generated, and click Next.
On the next screen, you can select the framework to use. Choose the latest version
(at the time of writing, that is .NET 6.0), leave Authentication type set to None, check the
ASP.NET Core hosted checkbox, and click Create. An example is shown in Figure 1-13.
Wait for Visual Studio to complete. Then build and run your solution by pressing F5.
After a little while, the browser will open and display the Blazor application.
19
Chapter 1 Introduction to WebAssembly and Blazor
code .
Or you can open VSC and then select File ➤ Open Folder….
When Code has loaded everything (be patient), it will pop a question as in
Figure 1-14. Answer Yes. This will add a folder called .vscode with configuration files
adding support for building and running the project from Code. If you already have a
.vscode folder (because you copied an existing project, for example), you will not get this
question.
Thanks to this integration with Visual Studio Code, you can simply press F5 to build
and run your project.
Note VSC now uses Workspace Trust which might pop up a dialog asking if you
trust the authors of a project. When opening the provided code download, you will
probably encounter this.
20
Chapter 1 Introduction to WebAssembly and Blazor
This generated Single-Page Application (SPA) has on the left side a navigation
menu allowing you to jump between different pages. On the right side, you will see the
selected component; in Figure 1-15, it is showing the Index component. And in the top
right corner, there is an About link to https://blazor.net/ which is the official Blazor
documentation website.
The Index component shows the mandatory “Hello, world!” demo, and it also
contains a survey component you can click to fill out a survey (this is a real survey, so
please let Microsoft know you like Blazor!). The SurveyPrompt is the first example of a
custom Blazor component. We will discuss building components like SurveyPrompt in
Chapters 3 and 4.
21
Chapter 1 Introduction to WebAssembly and Blazor
In the navigation menu, click the Counter link. Doing so opens a simple screen with
a number and a button as illustrated in Figure 1-16. Clicking the button will increment
the counter. Try it!
In the navigation menu, click the Fetch data link. Here, you can watch a (random and
fake) weather forecast as shown in Figure 1-17. This forecast is generated on the server
when asked by the client. This is very important because the client (which is running
in the browser) cannot access data from a database directly, so many times, you need a
server that can access databases and other data storage. Of course, if this was a Blazor
Server application, you can access the database directly because you are running on
the server.
22
Chapter 1 Introduction to WebAssembly and Blazor
to compile everything. Hey, you could even switch between Visual Studio, VS for Mac,
and VSC because they all use the same project and solution files!
app.UseHttpsRedirection();
app.UseBlazorFrameworkFiles();
app.UseStaticFiles();
app.UseRouting();
24
Another Random Scribd Document
with Unrelated Content
már nem keltheti fel: csak áltatjátok magatokat és felültetitek
egymást. A lényegben van itt a veszedelem, és nem a tréfás
garnirungban. Képtelen vagyok megérteni a Lisnevszkátokat. Nem
abban látja a nagyobb bajt, hogy a szegény emberek egy szobában
alusznak a gyermekeikkel, hanem abban, hogy a szegény emberek
nem magyarázzák el a gyermekeiknek – idejekorán és alaposan – a
mit az egyetlen szobában gyanítaniok kell, de a mit még nem
tudnak. Mintha mégis jobb volna emezeknek, ha nem kellene
gyanítaniok semmit és nem volna szükségük szüleik sürgős
magyarázatára.
– Hiszen akkor te nem vagy feminista!
– De az volnék, vagy mi, és szeretném, ha propagandát tudnék
csinálni annak a hitemnek, hogy a nőknek, igenis, minden téren
joguk van a munkához. De éppen azért szeretném, ha egyszer már
abbahagynátok a felvilágosítás kérdésének a bolygatását. Mért nem
álltok már egyszer valami egyébbel a nyilvánosság elé? Azt hiszem,
tanultunk már annyit, hogy érdeklődhetünk más valami iránt is. Mért
adtok fegyvert az ellenségeink kezébe? Vagy talán ezeknek van
igazuk, és a legkényesebb téma folytonos feszegetése: a gyermekek
felvilágosítása volna az az egyetlen női munka, a mely benneteket
igazán és komolyan érdekel?!…
RÉGI ISMERŐSÖK.
I.
Kedves Aranka,
szeretnék röviden felelni a kérdésedre és a kérdésedben foglalt
hallgatag szemrehányásra. Csakhogy ez nem olyan könnyű dolog. Az
eset bonyolultabb, mint képzeled. Hosszasan kell szólnom, hogy
megmagyarázhassam azt a lépést, a mely téged annyira meglepett.
Nem unod? Neked, az egyetlennek a világon, elmondhatok mindent.
Mindent, a mi a fejemben jár.
Ismered-e a Lady Hamilton élettörténetét? Aligha. Kevés asszony
van, a kit ez a példa gondolkozóba ejtett. Én könyv nélkül tudom
ennek a nőnek egész életrajzát, a mint sokan vannak, a kik könyv
nélkül tudják a nagy Napoleon kalandokban gazdag történetét.
Lady Hamilton mint peszra kezdte; aztán szobaleány lett egy
fogadóban. Elcsábították, és az aszfaltra került… azaz, hogy akkor
még nem volt aszfalt, de mindegy… Szóval, London utczáin kóborolt,
és a barátságos mosolygást szórta, a mikor többek között egy
droguistával akadt össze. A droguista lepingáltatta a szép leányt a
plakátjaira, igéretül, hogy: ilyen lesz az, a ki az ő kozmetikus szereit
használja! A plakát feltünt egy divatos festőnek; felkutatta a kép
eredetijét, és Lady Hamilton, a kit akkor még Harte Emmának
hivtak, elszegődött a hires festőhöz modellnek. A műteremben
megismerkedett egy gazdag fiatalemberrel. Ez ráköltötte az egész
vagyonát, s mikor mindenből kifogyott, temérdek adósságot csinált a
szép Emma kedvéért.
Ekkor uj alak jelenik meg a szinen: a fiatalember nagybátyja,
Lord Hamilton, Anglia nápolyi követe, a ki állomáshelyéről egyenesen
azért jött Londonba, hogy rendet csináljon és öcscsét elválaszsza a
sziréntől. Csakhogy a nagykövet még jobban meghabarodik, mint a
tékozló ifju; a haladottabb kornak szép kiváltsága, hogy az
őrültségben nem tart mértéket, mert azt tartja, hogy: ha lud, hát
legyen kövér! Lord Hamilton tehát kifizeti öcscsének az adósságait; a
fiatalember ennek fejében lemond kedveséről a nagybácsi javára; a
nagybácsi habozás nélkül feleségül veszi az egykori peszrát,
szobaleányt, stb… felpakolja, és elviszi Nápolyba.
Itt már rohamosan halad előre Emma. Meghódítja egész Nápolyt,
meghódítja Mária Karolina királynét, és végül meghódítja Nelson
admirálist, a későbbi abukiri győztest és trafalgari hőst. Nelson épp
olyan akarattalan sakkfigurává válik Emmának a kezeben, mint az
öreg nagykövet, s ettől fogva Lady Hamilton olyan befolyással van a
politikára, a milyen befolyással mostanában már a királynők közül is
csak kevesen dicsekedhetnek. Ha nem ismered történelmi
szereplésének a részleteit se, s olvasni akarsz egyetmást arról, hogy
milyen diplomácziai cselszövések teltek ki tőle – ezt megtalálhatod
akármelyik jobb lexikonban.
De szereplésének ez a része már nem tartozik a dologra.
»Előélet«-ének kevésbbé ismert részleteit is csak azért írtam le ilyen
hosszan, hogy megmutassam neked: »Látod, ez az asszony nagyobb
utat tett meg, mint a nagy Napoleon!«
És mi volt a segítségére, hogy megtudta tenni ezt a nagy utat?
Csak a szépsége, meg az esze.
Előttem van az arczképe. Mása annak a képnek, a melyet
Romney festett róla, akkor, a mikor az utczáról felszedte. És előttem
vannak a levelei. Hidd el, becsületszóra, hogy nem volt szebb, és
nem volt eszesebb, mint én.
Nápolyban szépen kiművelődött, de hozzám képest mindig csupa
tudatlanság maradt. Ismerd el, hogy még nem is hallottál olyan
nőről, a ki többet tudna, mint én. Megtanultam mindent, a mit az a
fiatalember tud, a ki kitünően végzi az egyetemet. Mulatságot
találtam száraz jogi ismereteknek a megszerzésében; érdekelt és
folyton foglalkoztat a társadalomtudomány; úgy olvasom a
közgazdasági könyveket, mint te a regényeket. Mintha csak
politikusnak készültem volna, a ki a képviselőséget ambicziója
kielégítésére akarja felhasználni. Mindezt puszta unalomból. Mert
valóságos remeteségben kellett felnőnöm, s mert az eszem mindig
szomjazta a komoly szellemi munkát, a folytonos traininget. És
játékból olyan műveltséget, annyi tudást szereztem, hogy ennek
szoknyában aligha találod meg a párját.
De nem csak ennyiből áll a felsőbbségem Harte Emmával
szemben.
Sohase voltam se peszra, se szobalány; előkelő származásu
vagyok. Nincs »előéletem«, multam, a melyet fegyverül lehetne
használni ellenem – a mely gáncsot vethetne elém, akárhová,
akármilyen magasra törekszem. Többet mondhatok. Én vagyok a
kifogástalanság. Én vagyok az ideál. Egy tiszta leány, a ki mindent
tud!
Nekem nem kell olyan nagy utat tennem, mint Harte Emmának.
Miért ne juthatnék el éppen olyan magasra, vagy még magasabbra?!
Igen – ne nézz olyan nagyot! – én a hatalomra szomjazom! A
komoly dolgokkal való folytonos játékom feltüzelte bennem – az
ambicziót. Az ambicziót, mely ott szunnyad a női lélekben is, bár
bizonyos, hogy az ambicziónak ez a legkevésbbé egészséges
lakóhely… De nem voltak-e nők minden időben, a kik akarták és el
tudták érni a hatalmat?! A régi királynők szenvedélye támadt fel
bennem, azoké, a kik igazi királynők akartak lenni, és csakugyan
igazi királynők lettek!
Bámulsz? Egy huszonhárom esztendős leány, a ki nem a
szerelemről, hanem a hatalomról álmodik!
Hát én alighanem férfias lélek vagyok. A fiziológusok irataiból
tudom, hogy ez lányban, asszonyban nem éppen a legnagyobb
ritkaság. A lelke legmélyén minden ember megőriz egyetmást abból
az ősállapotból, a melyben még nem volt két különböző nem.
Bizonyos vagyok benne például, hogy a szerelemnek nem lehet
akkora hatalma rajtam, mint a legtöbb asszonyszemélyen. Hidegebb
vagyok, mint más.
Igaz, úgy is fordulhatott volna életemnek a sora, hogy az
ambiczió talán sohase támad fel bennem, és örökre beérem azzal, a
mi egy közönséges asszonynak az osztályrésze, jó vagy rossz sorsa.
Sokszor gondolok rá: milyen furcsa az élet! Ha az a Featherston
nevü ember, a ki Harte Emmát elcsábította s aztán kilökte az utczára,
véletlenül másféle alak, s magánál tartja, sőt feleségül veszi Harte
Emmát… ki tudja?!… Harte Emmából talán a legjobb feleség lett
volna, a ki harisnyát foltoz, krumplit hámoz, közben sok gyermekkel
örvendezteti meg a férjét, s nem is álmodik arról, hogy diplomácziai
cselszövések és Lady Hamilton-féle női alakok is vannak a világon!
Nekem is az utamba akadt egy ilyen Featherston. Ez ugyan
engem nem csábított el… ó, a legkevésbbé se!… De egy kis ideig
mégis tőle függött a sorsom.
Ha ez az ember véletlenül az, a kinek képzeltem, ha véletlenül
csakugyan olyan, a milyennek egy pár hónapig, vagy inkább csak
egy pár perczig hittem: akkor ez az ember, ez az egy, ez a
képzeletbeli, talán fel tudta volna kelteni bennem a szerelmet. Ha ez
az ember nem több, csak éppen igazán kedvem szerint való, és meg
tud győzni arról, hogy én vagyok neki az egész világ: akkor talán
lemondtam volna az ábrándjaimról és be tudtam volna érni a
szerelemmel. »Ülj mellém a kandallóhoz; fel van szítva melege«… és
ezután már csak holtan hordoztam volna magamban a Lady
Hamiltont.
Csakhogy ez a Featherston is olyannak bizonyult, mint a többi.
Mint mindegyik férfi, a kitől egy-egy nőnek a sorsa függ, olykor egy
pár perczig.
Miképpen leplezte le magát előttem? – minthogy nem
csábíthatott el, a mi különben eszeágában se volt, tehát nem is
lökhetett ki az utczára?
Csak így:
Ez a szegény ember azt hitte, hogy én éppen olyan gazdag
vagyok, mint te. Valami pokoli véletlenből nem is sejtette, hogy te
meg én csak féltestvérek vagyunk; nem tudta, hogy te az
édesanyádtól örökölted a vagyonodat, hogy én az én anyámtól nem
örököltem semmit, és hogy az apánknak sohase volt semmije. Azt
képzelte, a jámbor, hogy ha a testvérem olyan imádásraméltóan
gazdag, én is csak az lehetek. Még az eljegyzésünk után is azt
képzelte.
Mikor megtudta a kegyetlen igazságot, hősiesen viselte
elhamarkodott lépésének a következéseit. Sápadtan, de hősiesen.
Nem lépett vissza; ha minden elveszett, a becsületet nem akarta
elveszíteni.
Csakhogy nagyon folyt az orra vére; nem lehetett nézni, hogy
mennyire folyik az orra vére!…
C’était plus fort, que lui.
És mikor elbocsátottam, örökre, mintha lidércznyomástól
szabadult volna meg. Visszanyerte a szinét, a hangját, az életkedvét.
Hát alighanem jobb is így, mind a kettőnknek.
Mert hátha a kandalló melege se tudta volna megaszalni –
néhány perczig már halálra kárhoztatott – ábrándjaimat?!
Hátha a tűzhely mellett is kitört volna belőlem az ambiczió, és
eget kér, mialatt körülöttem a tűzhely tücske czirpel és a fazékban a
leves bugyborékol?!… Mily tragédia!
Szóval, most már szabadon élhetek a hatalomra való
vágyódásomnak.
Meglehet, hogy kineveted teljes gőzzel szabadjára bocsátott
szenvedélyemet, és lehetetlennek tartod, a mire törekszem.
Megvallom, engem is gondolkodóba ejtett néha, hogy a politikai
befolyásra, a hatalomra, a koronátlan királynői szereplésre majdnem
mindig csak az Aszpáziák és a Harte Emmák tettek szert.
Sohase, vagy csak kivételképpen az erős leányok és azok az erős
asszonyok, a kik a tisztességüket, vagy mondjuk: a társadalmi
kifogástalanságuk apró előnyeit se akarták elveszíteni.
A statisztika mindenesetre azt bizonygatja, hogy a hatalomhoz
vezető úton rendesen csak azok a nők nem törnek le, a kik – a
társadalmon kivül kezdik.
Könnyebben haladnak, mert már nincs veszíteni valójuk? A
veszíteni való itt csak túlsúly, teher?
Vagy olyan eszközeik is vannak, a melyeket a magunkfajta nő
nem ismer, s éppen ezek az előttünk ismeretlen eszközök teszik
lehetővé mind előbbre, mind magasabbra haladásukat?
Meglehet. Ha sok tekintetben különb vagyok, mint Lady Hamilton
– ez talán ereje volt neki, s nekem csak akadályom.
De nem hiszem azt, hogy ha egy nő fel akar jutni a legnagyobb
társadalmi magaslatra, ehhez okvetetlenül egy nagy vargabetüt kell
tennie a társadalmon kivül.
És egyebet is mondok.
Minden áron akarom a hatalmat. Bármi áron.
Nem hiszem, hogy erre szükség lesz… akármennyire megvetem a
világot, ennél mégis különbnek tartom… de ha valaha abba a
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com