Category "c++sharp"

The type initializer for 'System.Data.Entity.Migrations.DbMigrationsConfiguration`1' threw an exception

I have ASP.Net MVC site. Technology Stack ASP.Net 4.6 C#.Net EF 6 MySQL -Database While I am trying to generate the database using Nuget command:- Enable-Mi

Artificial Bee Colony library [closed]

I'm working on the implementation of Artificial Bee Colony algorithm in optimization of fuzzy c-means clustering. Can anyone provide a link fo

how to access a ref or out parameter from Parallel.For or Parallel.ForEach lambda expression

Consider my following (simplified) code: public double ComputeSum(List<double> numbers, ref double threshold, Object thresholdLock) { double sum = 0;

using (?s) Regex options in Visual Studio Code

I am used to writing regular expressions that support multiple options to specify case sensitivity, white space ignoring, meaning of . etc... In C#, these optio

How to read request body in an asp.net core webapi controller?

I'm trying to read the request body in the OnActionExecuting method, but I always get null for the body. var request = context.HttpContext.Request; var stream =

Receiving access denied error from Visual Studio when trying to change target framework

The error reads, TargetFrameworkMoniker: An error occurred saving the project file 'yadayada.csproj'. Access is denied. I'm trying to switch from .net 3

Element was null when I user page object pattern

I'm new to mobile automation, and I'm facing a problem with page object pattern. When I try to find element with FindElementById everything works, here is my cl

Clearing history while debugging azure durable functions

Durable functions keep a state in storage, this is what makes them work, but it is very troublesome while debugging and developing. I have a large number of run

User defined table type with dynamic columns in SQL Server

In my .NET (C#) win application, I import an Excel file that contains multiple columns of varying numbers. So, I store the data in my datatable in code and I ne

System.MissingMethodException: Method not found: 'Void Microsoft.AspNetCore.Identity.DataProtectorTokenProvider

Stil on same project where I had issue DI Registration service type .net core 3.0. Now when that is fixed I'm getting new error. Now my code looks: servic

Assignment in an if statement

I have a class Animal, and its subclass Dog. I often find myself coding the following lines: if (animal is Dog) { Dog dog = animal as Dog; dog.Name

Retrieving values from multidimensional arrays

I have an array something like this: int[,] multiDimensionalArray2 = { { 1, 2 }, { 4, 5 } }; if I want to retrieve 1 and 2 and feed them into this: int a; i

Visual Studio 2022 turn off auto indenting

So i upgraded to VS 2022. and anytime i add a semicolon. the whole code block gets backtabbed. does anyone know how to turn this off? getting tired of hitting c

Make Https call using HttpClient

I have been using HttpClient for making WebApi calls using C#. Seems neat & fast way compared to WebClient. However I am stuck up while making Https calls.

Make Https call using HttpClient

I have been using HttpClient for making WebApi calls using C#. Seems neat & fast way compared to WebClient. However I am stuck up while making Https calls.

Settings.Default.Upgrade() does not keep current settings

I have a WPF application that uses the built-in Settings functionality. When I release a new version of the application, I increase the assembly version and exe

Pass complex parameters to [Theory]

Xunit has a nice feature: you can create one test with a Theory attribute and put data in InlineData attributes, and xUnit will generate many tests, and test th

asp.net - How to find outlook mail attachment by ContentId Property

I can find email attachment from a MailMessage by ContenId like the following code : System.Net.Mail.MailMessage objNewMail = null; System.Net.Mail.Attachment

Get named MAPI Property from MailItem in C#

I'm developing an Outlook 2010 custom plugin in C#. This is my first time using C# (I'm a java guy normally). There is a named (custom) MAPI property on a mess

Windows Sensor API access from .NET with C#, VS2015 and Windows 10

How can I access the Windows Sensor API from C#? Everything I can find is either for C++ or referencing outdated libraries. I tried using the Windows API Code P