Category "c++sharp"

C# - Fetching property value from child class

I access property value from a class object at run-time using reflection in C#. public bool GetValue(string fieldName, out object fieldValue) {

How to exclude a .NET 6 Minimal API from code coverage?

I maintain a class library which contains several reference implementations to demonstrate how the library should be used. I have reference implementations for

Verifying ArgumentException and its message in Nunit , C#

In my test program in Nunit, I want to verify that it's getting the write Argument Exception by verifying the message. [Test] public void ArgumentsWork

How to call an extension method without using

using System; class Runner { static void Main() { A a = new A(); // how to say a.PrintStuff() without a 'using' Console.Read();

Writing and reading using socket

This is my code using UnityEngine; using System.Collections; using System; using System.IO; using System.Net.Sockets; public class s_TCP : MonoBehaviour { in

MongoDB Driver Builders<dynamic> dont work on equal to date

I am unable to get the result I wanted when I try to get Date equal to. FilterDefinition<dynamic> searchFilter = FilterDefinition<dynamic>.Empty; st

MongoDB Driver Builders<dynamic> dont work on equal to date

I am unable to get the result I wanted when I try to get Date equal to. FilterDefinition<dynamic> searchFilter = FilterDefinition<dynamic>.Empty; st

How to round up value C# to the nearest integer?

I want to round up double to int. Eg, double a=0.4, b=0.5; I want to change them both to integer. so that int aa=0, bb=1; aa is from a and bb is from b

Microsoft.OpenAPI examples or documentation?

Just tried to use Swashbuckle 5 rc2 + Microsoft OpenAPI implementation but struggling to make sense of how to inject the security requirements using the OpenApi

How to mock an IFormFile for a unit/integration test in ASP.NET Core?

I want to write tests for uploading of files in ASP.NET Core but can't seem to find a nice way to mock/instantiate an object derived from IFormFile. Any suggest

How to implement left join in JOIN Extension method

I am trying to implement an outer join on this kind of query for the p.Person table. How would I do this? This example is taken from http://ashishware.com/DSLi

Areas do not work when migrating an Angular app to NET 6

I have an .NET Core 5 with Angular app and I have my controllers grouped in areas. I made the app using NET Core 1 and have successfully migrated it up to 5 wit

What is the difference between “int” and “uint” / “long” and “ulong”?

I know about int and long (32-bit and 64-bit numbers), but what are uint and ulong?

VS 2022 - cannot change Target Platform to .Net 6.0 for a project created in VS 2019

Just installed VS 2022 on a machine, after I removed VS 2019 (VM with limited space). VS 2022 installed fine. I can create a .Net 6.0 project and compile it -

How can I get task-specific properties from a MailItem

I've been having a little weekend project for myselff which involves getting all my ToDo tasks from Outlook, put them in a DataGridView and me being able to edi

Drawing a line on a bitmap

I made a face dector in matlab, and I am translating it into c# code, I everything is moslty done. In the main I use System.Drawing.Bitmap b = new Sy

how do i return this instance of the IInfocard interface?

i am currently trying to return a instance of the Iinforcard interface within my "createNewInfocard" function, however i keep running into error CS0266. i am un

Update button in datagrid, entity framework WPF Application

I'm attempting to create an update button, that you can press to automatically update a record within a DB. the update button opens a new dialog, which then all

Is it possible to superimpose an interface on an external class in C#?

In order to hide the concrete implementation of a class behind an interface, for example for dependency injection, I find it is useful to extract an interface w

Problem in Azure DevOps pipeline restoring AutoMapper NuGet package in .net 6

I get the following error message when my pipeline is being run: Package AutoMapper.Extensions.Microsoft.DependencyInjection 8.1.1 is not compatible with net60