Category "c++sharp"

How to abort a Task like aborting a Thread (Thread.Abort method)?

We could abort a Thread like this: Thread thread = new Thread(SomeMethod); . . . thread.Abort(); But can I abort a Task (in .Net 4.0) in the same way not by

How to return a specific status code and no contents from Controller?

I want the example controller below to return a status code 418 with no contents. Setting the status code is easy enough but then it seems like there is somethi

How to make a circle type buffer around NetTopologySuite Point with radius in N meters?

I have to draw a circle with N meters diameter around some geolocation. I could able to generate coordinates for vertically oriented ellipse only. C# using NetT

Chrome WebDriver does not open when called from IIS

I have a really strange issue (And I have a really strong suspicion - that it will be on the IIS side). I have .NETCORE6 application, which uses Selenium via IH

C# arrow key input for a console app

I have a simple console app written in C#. I want to be able to detect arrow key presses, so I can allow the user to steer. How do I detect keydown/keyup even

How to get SMTP address for exchange user quickly?

The below is my code, the PrimarySmtpAddress use 50ms which need more than 15 s to load more 300 users. I am not familiar with Outlook API, and it seems this Pr

DateTime vs DateTimeOffset

What is the difference between a DateTime and a DateTimeOffset and when should one be used? Currently, we have a standard way of dealing with .NET DateTimes in

How do I solve a "view not found" exception in asp.net core mvc project

I'm trying to create a ASP.NET Core MVC test app running on OSX using VS Code. I'm getting a 'view not found' exception when accessing the default Home/index (o

Deploying NetFwTypeLib to manage the Windows Firewall

My Windows service needs to create/remove certain rules from the Windows firewall. For this I interface with NetFwTypeLib in <windows>\system32\hnetcfg.dl

mvc 4 Model is null

i'm using razor's listboxfor for the first time, but my Model is always null. after reading similar posts and tryouts it still won't work. Person.cshtml @mode

Separating business logic

I have a customers Class with properties and methods defined. At present it contains methods for any type of task associated with Customers. For example, it con

ManagementObject Class not showing up in System.Management namespace

I'm trying to write some WMI in my windows form and the ManagementObject is givin me the "The type or namespace name 'ManagementObject' could not be found" Er

Changing the default icon in a Windows Forms application

I need to change the icon in the application I am working on. But simply browsing for other icons from the project property tab -> Application -> Icon, it

How to queue a completion port action (I/O bound function) to CLR ThreadPool

I have an external library that does long running I/O. I wish to create a multithreaded application that will use ThreadPool to limit simultaneous number of thr

Getting Elapsed Time with DispatchTimer to 1 millisecond accuracy

I'm trying to measure the elapsed time in milliseconds between keypress events using a dispatch timer but when declaring a dispatch timer to have an interval of

Performance cost of 'new' in C#?

In C# what is the performance cost of using the new keyword? I ask specifically in relation to games development, I know in C++ it is a definite no-no to be new

Using GetHashCode to test equality in Equals override

Is it ok to call GetHashCode as a method to test equality from inside the Equals override? For example, is this code acceptable? public class Class1 { pub

.NET OutOfMemoryException

Why does this: class OutOfMemoryTest02 { static void Main() { string value = new string('a', int.MaxValue); } } Throw the exception; but

EntityDataSource - how to do WHERE Clause from different table

Hi I am using EF 4 and EntityDataSource in a Page (WebForms). This page contains a DropDownList that display UserName. Data from this DropDownList it is from "

Moq Expression with Constraint ... It.Is<Expression<Func<T, bool>>>

Ok, I am having a hard time trying to figure out how to setup a moq for a method that takes in an expression. There are a lot of examples out there of how to to