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"..
using System;
using System.Net;
using System.Net.Mail;
using System.Text;
public class Program
{
public static void Main()
{
// 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, code
MailAddress from = new MailAddress("sender@gmail.com", "Someone", Encoding.UTF8);
MailAddress to = new MailAddress("benzzon@gmail.com"); // toAddress
MailMessage message = new MailMessage(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 = new SmtpClient("smtp.gmail.com", 587);
// IMPORTANT: Password needs to be set on the line below!
smtp.Credentials = new NetworkCredential("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
Update Nuget packages (skip major update) (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
Keywords: Nuget
Get list of Nuget packages in Visual Studio solution
PowerShell-script below can be used to get all Nuget-packages in a solution (.sln) as a CSV-file.
(Json-output is parsed into CSV)
Save script as file "GetNugetListCSV.ps1" and use command below to get Nuget list from example.sln:
Powershell-script:
Keywords: Nuget PowerShell VisualStudio