How to get a Long Date format from DateTime without a weekday
String formattedDate = DateTime.Now.Date.ToLongDateString().Replace(DateTime.Now.DayOfWeek.ToString()+ “, “, “”)
String formattedDate = DateTime.Now.Date.ToLongDateString().Replace(DateTime.Now.DayOfWeek.ToString()+ “, “, “”)
The generic argument being used does not match the arguments of the member being mocked. Remove the generic argument VeracrossMock .Setup(_ => _.GetStudentsAsync(1, null, CancellationToken.None)) .ReturnsAsync(resp); and the method will infer the desired generic arguments based on the member being mocked.
This is one of the way to change the build framework in Rider. It allows you to switch the MSBuild version explicitly by selecting MSBuild.dll. When you have multiple .NET framework, you can change it here. This example is for .NET core project. In my system I installed latest .NET core RC after which Rider … Read more
You can return using hardset status codes like Ok(); or BadRequest(); Or return using a dynamic one using StatusCode(<Your status code number>,<Optional return object>); This is using Microsoft.AspNetCore.Mvc Below is this.StatusCode spelled out a little more: /* “this” comes from your class being a subclass of Microsoft.AspNetCore.Mvc.ControllerBase */ StatusCodeResult scr = this.StatusCode(200); /* OR */ … Read more
Option 1 – ASP.NET Web Application Option 3 – ASP.NET Core Web Application Although both project templates use Full .Net Framework, Option 1 is for creating projects using legacy version of ASP.NET MVC in which we can use Global.asax. Option 3 is totally new concept in which wwwroot folder, using task runners and everything is … Read more
First use the xUnit Test Project (.NET Core) project template. Then go edit the .csproj file and change <TargetFramework>netcoreapp2.2</TargetFramework> to <TargetFramework>net462</TargetFramework>. That’s it. 🙂
I had to change using Microsoft.Practices.unity; to using Unity; I think because of an update in Unity with NuGet
Here’s what I’ve managed to find after a very limited search through dotnet/corefx repository on github. [Intrinsic] marks methods, properties and fields that can be potentially replaced/optimized by JIT. Source code comments say something similar (IntrinsicAttribute.cs): Calls to methods or references to fields marked with this attribute may be replaced at some call sites with … Read more
private System.Drawing.Bitmap BitmapFromSource(BitmapSource bitmapsource) { System.Drawing.Bitmap bitmap; using (MemoryStream outStream = new MemoryStream()) { BitmapEncoder enc = new BmpBitmapEncoder(); enc.Frames.Add(BitmapFrame.Create(bitmapsource)); enc.Save(outStream); bitmap = new System.Drawing.Bitmap(outStream); } return bitmap; }