Check out Spectre..Console. In the code below the generic method Get only accepts int, not decimal or double. If they press ENTER the default value of 0 is set to the variable.
using System;
using Spectre.Console;
namespace ConsoleApp1
{
internal partial class Program
{
static...
With SeriLog, write to a new file each day and if desire remove old folders after a period of time. Also, SeriLog supports writing to a database so as with writing to a file you can write a job to remove old records. See the following GitHub repository for various samples and best practices.
Seems like one option for sticking with app.config is to create a custom template with an app.config in the project and manually add in code to get settings.
public class PositionOptions
{
public const string Position = "Position";
public string Title { get; set; } = String.Empty...
If considering using T4 templates see one of mine here. Note in the link I've provided guidance on ways to colorize templates as Visual Studio does not natively support T4 template syntax coloring. There is a script included to create the database. Also, although the code uses NET8 the template...
Coming from an Assembler to C as first languages all I can say is happy to leave them behind. Perhaps there might be a small edge on knowing C but not anymore with the Visual Studio ecosystem.
For learning C#, check out the following book C# 12 and .NET 8 – Modern Cross-Platform which I have no read but was highly recommended by a Milan Jovanovic who I know from Twitter. Another resource is Foundational C# with Microsoft.
There are really no books on learning Visual Studio but check...
True that there is a erasure issue yet some of this can be handled with partial classes for EF Core or if the changes are small enough and working with dependency injection the changes in a DbContext should not matter as the connection aspect would be (for ASP.NET Core for instance) in...
Considerations, with ADO, in your current code, if column names change in the database table(s) you need to manually update your code while with EF Core using EF Power tools simply run the reverse engineer process again and all code is updated. Also, everything is strongly typed. As indicated by...
A good places to start,
learn C# Microsoft
C# W3 schools
SQL W3 schools
Tips
Take your time learning C# and SQL basics
Start with the basics for C#, do not be jumping into the deep end (deep end means you are not familiar with a specific method of coding).
Work with console projects to...
Free is not allows the best way to go if committed to learning and to get a job, expect to spend at least two years of learning how to programming.
Get started with learning how to work with databases with a recommendation with SQL-Server without C# as any job that uses C# will need database...
I wonder about this and what stopping them from downloading but alas even know that I still find value in posting it.
Perhaps if this is because of a company policy they might ask for an exception to the rule.
Look at SpreadSheetLight which is a free to use library for .xlsx Excel
public static void ExportToExcel(DataTable table, string fileName, bool includeHeader, string sheetName)
{
using var document = new SLDocument();
// import to first row, first column
document.ImportDataTable(1...
See my article ASP.NET Core/Razor pages working with Checkboxes which takes a different approach than what you are doing.
OnPost
Logging in this case is SeriLog
public Task<IActionResult> OnPostResendAsync()
{
// get checked
var checkedItems = CheckModels.Where(x =>...
Here is an example that has two submit buttons, first redirects back to the same page passing a string then in the Get sets a property which in turn on page load presents a popup while the second submit does nothing other than write to the console.
Full source
using Microsoft.AspNetCore.Mvc...
Realizing this is a month old question thought it is still worth posting the following example which is done with .NET Core, C#9 which will need modifications if using .NET Framework.
To keep code clean and concise, consider using NuGet package SnippetSpectre.Console.
Collecting user input...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.