Link to Repl.it example that will send a mail using SMTP: https://replit.com/@NisseBengtsson/smtp-test (Code works from Replit when "app password" has been set, but dotnetfiddle does not allow SMTP.)
Below is the code copied from "Replit" just in case it might "get lost"..
usingSystem;usingSystem.Net;usingSystem.Net.Mail;usingSystem.Text;publicclassProgram{publicstaticvoidMain(){// Example to send email using SMTP.// Using Gmail requires that you configure an "app password"..// (since you otherwise will need 2-factor authentication))// This password is probably in the form of a string like "aaaa bbbb cccc dddd eeee".// fromAddress, fromName, codeMailAddress from =newMailAddress("sender@gmail.com","Someone", Encoding.UTF8);MailAddress to =newMailAddress("benzzon@gmail.com");// toAddressMailMessage message =newMailMessage(from, to);
message.Subject ="This is a test-mail";
message.SubjectEncoding = Encoding.UTF8;string dateTime = DateTime.Now.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
message.Body =$"This is just a test-mail sent from replit.com.. ({dateTime})";
message.BodyEncoding = Encoding.UTF8;SmtpClient smtp =newSmtpClient("smtp.gmail.com",587);// IMPORTANT: Password needs to be set on the line below!
smtp.Credentials =newNetworkCredential("benzzon@gmail.com","PASSWORD");
smtp.EnableSsl =true;try{
smtp.Send(message);
smtp.Dispose();
message.Dispose();
Console.WriteLine("Mail was sent.");}catch(Exception ex){
Console.WriteLine("Exception occurred.. "+ ex.Message);}}}
Comments
Conditional Ternary Operator (x == y) ? truehere : falsehere
Use the "conditional ternary operator" instead of "if-else".
.NET Fiddle and Replit (Repl.it)
Testing C# using .NET Fiddle:
https://dotnetfiddle.net/
Link to Repl.it example using "Linq":
https://replit.com/@NisseBengtsson/linq-sample-1#main.cs
Link to Repl.it example that will send a mail using SMTP:
https://replit.com/@NisseBengtsson/smtp-test
(Code works from Replit when "app password" has been set, but dotnetfiddle does not allow SMTP.)
VS Code Explains - Linq in C#
Nice overview of Linq "operations":
https://steven-giesel.com/blogPost/00443661-f75b-4694-852b-175b4a10d6c4/linq-mindmap-net-10-edition
Testing-methods, the "Testing Trophy"
Nice concept/strategy of general guidance for testing; the "Testing Trophy" from Kent C Dodds.

Video "The Ultimate Guide to Testing" from SingletonSean.
Testing "tio"
Link to "Try It Online" (tio):
Try it online!
MAUI UI-kit UraniumUI
https://github.com/enisn/UraniumUI
Dotnet-outdated-tool
Show and update Nuget-packages from command line:
Install "dotnet-outdated-tool": dotnet tool install --global dotnet-outdated-tool
Show outdated Nugets using: dotnet outdated
Update all Nugets using (but avoid major updates): dotnet outdated -u --version-lock Major