Category "c++sharp"

Groups the specified bookings based on their consecutive dates

var listForTestGroup = new List<Booking> { new Booking{Project="HR", Date= DateTime.Parse("01/02/2020") , Allocation= 10},

How do I obtain 100% coverage when an exception is thrown in a unit test?

In C# you can catch an exception in the default test suite like this: [TestMethod] [ExpectedException(typeof (ArgumentNullException))] public void TestNullComp

Checking file type from base64?

I have a WCF REST Service with the following OperationContract that saves files on the disk: [OperationContract] [WebInvoke(UriTemplate = "FileSave", Method = "

Using multiple authentication providers in C# .net core

We had .net core API already authenticating with AzureAd and then a new requirement came to authenticate the same API using Auth0 as well while keeping existing

Binanace get Order Book in C# .Net Core

i'm part of a MarketMaker team and currently need to get crypto Market Data from Binance. Here are the requirements... get public market data, so dont have api

Find closed loops between a series of connected points

So I've been trying work out how to approach what i initially was a simple problem - turns out i'm an idiot and have no idea what i'm doing. Firstly my data st

Override App.config value with an environment variable

I have a C# console program that prints an App.config value. Can I override this value from an environment variable? Example App.config: <appSettings>

InvalidOperationException: No authentication handler is registered for the scheme 'CookieSettings'.Did you forget to call AddAuthentication()

I am developing an application using ASP.Net MVC core 2.1 where I am continuously getting the following exception. "InvalidOperationException: No authentica

Create mail where Outlook is not running in Administrative rights

The below code works in my desktop application if: Outlook is not running Outlook is running in Administrator rights When Outlook is running normally, the code

The type or namespace name 'Parse' does not exist in the namespace 'Enum'

I have System in my namespace, what am I missing? I am brand new to C# and am following a course on Udemy and following a book titled C#8.0 and .NET Core 3.0 -

extract all URLs in a free text block using RegEx [duplicate]

I'm attempting to detect all URLs listed in a free text block. I'm using the .nets Regex.Matches call.. with the following regex: (http|https)

Auto Close Message Box

I have this program wherein I use timer to redirect to another page. It do work but the problem is when I click cancel button a messagebox will appear and when

C# execute a terminal command in linux

I want my c# application (which I execute on a raspberry pi) to run a bash script whenever it starts.. basically : the script is located in /etc/init.d and is n

Generic Method to Flatten a Collection of Nested Objects into a DataTable?

I have a list of objects, which in turn contain nested lists of further objects. I would like to flatten the object graph into a DataTable. I found code which t

Performance between Iterating through IEnumerable<T> and List<T>

Today, I faced a problem with performance while iterating through a list of items. After done some diagnostic, I finally figured out the reason which slowed dow

Getting the result of a computed column from database into an entity

In a project using Entity Framework, say I have an entity such as [Table("MyTable")] public partial class MyTable { public string FirstName { get; set; }

.NET5 send push notification to Apple devices

At the moment I'm programming a REST service in .NET5 for Apple Wallet. All works fine now, registering, unregistering, manual update a card. The problem is the

How to get enum value by string or int

How can I get the enum value if I have the enum string or enum int value. eg: If i have an enum as follows: public enum TestEnum { Value1 = 1, Value2

How to get Selenium C# control names for reporting

I'm wanting to report a line every time my selenium based automation framework clicks on a control. My object repository is storing individual controls like thi

How can i save a file that i create into a path

I´m developing a school project where i need to export a html table into a csv file, and when i click in a button i need to save that file into a path lik