Getting started with C on Windows can be done easily by downloading Visual Studio, especialy if you are targetting Windows itself. When targeting Linux it’s of course best to get an actual linux os to get started. Both WSL and Hyper-V makes it easy to create and run an actual Linux distro on Windows, however …
Author Archives: andreassundstrom
Uploading files to ASP.NET Core
During a project I needed to make the user upload a csv-file to a controller, process it and store the result in a database. The upload form A simple html-form object is enough to be able to upload a file to a controller. asp-controller and asp-action tag helpers makes it easy to point the form …
C# basics: Delegates
Delegates are a way to declare accepted properties and returntype of methods, without having to write the actual code for the method. This can be handy when the method of an object depends upon the actual object itself. When writing methods you define returntype, parameters and the actual code to be performed, the function body. …
C# basics: $pecial Ch@racters
String interpolation – $ Definition of interpolate: transitive verb 1a: to alter or corrupt (something, such as a text) by inserting new or foreign matter b: to insert (words) into a text or into a conversation Source: Merriam-webster When you want to insert code expressions in a string, using a string interpolation with the $ character in front …
C# basics: foreach loops
foreach loops are used to loop through collections of objects. C# has many standard type of loop functions, but the foreach loop is a special case. It can however be broken down to basic components to understand how it works. Imagine you have an array of cars that you iterate with a foreach loop: //The …
