Home About

All posts tagged with "C#"

C# (C-sharp) is a general-purpose programming language using strong typing, It was developed around 2000 by Microsoft and used on the .Net platform.

← Newer Posts Page 2 of 10 Older Posts →

C# - How to create a named tuple or list of named tuples

There are two reasons you are on this page: 1) you forgot the syntax for named tuples 2) You have just learned about named tuples and »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C# 04 June 2022

C# - How to connect to a MSSQL database using a SqlConnection

You can use the SqlConnection class to connect to a MSSQL server. If we have a database called MyDb with a simple table called MyEntities: CREATE »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, MSSQL 01 June 2022

C# Build error - An instance of analyzer <analyzer> cannot be created

I recently got the following error when trying to build a solution after installing a nuget package: > Warning CS8032 An instance of analyzer ProxyInterfaceSourceGenerator.ProxyInterfaceCodeGenerator cannot »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, .Net 18 May 2022

C# - How to mock or stub a class without an interface

Sometimes you come across a class that you need to stub or mock but it does not have an interface. The easiest way is of course »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Test doubles, Testing, Unit tests, C# 15 May 2022

C# - What is the difference between new and override + virtual

This is an area of C# where there is a big "gotcha". Using the new keyword or using the virtual + override keywords behave very differently, we »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, class 15 May 2022

C# - How to set a BaseAddress using the HttpClient

If you would rather work with relative URLs than absolute URLs you can use the BaseAddress [https://docs.microsoft.com/en-us/dotnet/api/system.net.http. »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C# 08 May 2022

C# - Set the URL per request using the HttpClient

This might seem trivial, but since I got the question the other day I might as well make a post about it. Using the HttpClient [https: »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on HttpClient, C# 08 May 2022

Error - CS0579 Duplicate 'global::System.Runtime.Versioning.TargetFrameworkAttribute'

I got the following errors today while working on a new project: > Error CS0579 Duplicate 'System.Reflection.AssemblyVersionAttribute' attribute MyAzureFunction C:\Repos\Test\MyAzureFunction\obj\Debug\ »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on C#, Error 23 April 2022

Entity framework - How to add static data using data seeding

I am not sure that the correct term is "static" data - it seems to be known as seeding, which is the term I will use. »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Entity Framework, C#, .Net, MSSQL 10 April 2022

Entity framework - Unable to create an object of type <type>. For the different patterns supported at design time see <link>

Today I was trying to make an initial migration using Entity framework. I encountered an error when calling dotnet ef migrations add InitialCreate: C:\Users\peter\ »

Peter Daugaard Rasmussen Peter Daugaard Rasmussen on Entity Framework, C#, MSSQL 05 April 2022
← Newer Posts Page 2 of 10 Older Posts →
Rss
Twitter
LinkedIn
profile for Peter Rasmussen at Stack Overflow, Q&A for professional and enthusiast programmers
Peter Daugaard Rasmussen - developer, Consultant, Blogger © 2022 Cookie policy