Category "c++sharp"

Unity C# : Destroy object when a new scene loads

currently I have a timer that has DontDestroyOnLoad function in order for it to cycle through scenes that needed a timer, my question is how can I destroy my ti

Call a Method On Hot Reload

I am making a game using Visual Studio 2022 and C# and I was wondering if it was possible to trigger some code when you hot reload your app (whilst it's running

Send client side data Queue to server side through Tcp/IP

I wanna send data from client to server. There are two queues. in client side and in server side. I want to my client to be connected to the server and send all

How to mock Repository/Unit Of Work

In my app I have generic repository connected to controller through UnitOfWork. I want to unit test my app. To make this I need to mock db connection. Can you t

Cannot convert lambda expression to type 'IValueResolver<Entity, MyDto, object>' because it is not a delegate type

I am trying to define this simple mapping in my profile CreateMap<CompanyClient, MyDto>() .ForMember( dto => dto.PaymentTerms, opt => opt.M

Why does a static constructor not have any parameters?

Per MSDN: A static constructor does not take access modifiers or have parameters. A static constructor is called automatically to initialize the class before t

Interfaces — What's the point?

The reason for interfaces truly eludes me. From what I understand, it is kind of a work around for the non-existent multi-inheritance which doesn't exist in C#

Get filenames without path of a specific directory

How can I get all filenames of a directory (and its subdirectorys) without the full path? Directory.GetFiles(...) returns always the full path!

How can I change the background color of the Infragistics' UltraGrid filter row?

Currently this is what it looks like: I'd like to change that blue color, but I don't know what property to change. I've tried changing what I think is t

Custom ContextMenu Command in Datagrid's Textbox from ViewModel

I have a UserControl which includes Datagrid. Inside Datagrid I've set EditingElementStyle with Textboxes that have ContextMenu for Copy/Paste commands. I need

Form view designer is not working in Visual Studio 2019 with C# .NET Core 3.1 [duplicate]

When I am opening a Visual Studio project with VB.NET then the Form view designer is automatically opened, but when I open a new project

Date Diff By Ignoring Leap Days

Please share some logic to find date difference between two dates which would ignore leap days, c# Subtract method includes the leap days. E.g. for startDat= 26

Insert radio button selected value into database

I am building a C# Windows application with 2 radio buttons for gender. I'm using a simple insert query to insert data in the database. Can anyone help me wit

'Forms' does not exist in the namespace system.windows

I have just started working on c#, and was fiddling with some code sample that I got from some forum. This code is using a namespace using system.windows.forms

Custom ContextMenu Command in Datagrid's Textbox from ViewModel

I have a UserControl which includes Datagrid. Inside Datagrid I've set EditingElementStyle with Textboxes that have ContextMenu for Copy/Paste commands. I need

Fastest way to search Nested List<> in C#

I have a List<> which contains another List<> I need to find if a given value is present in any of the items in the innermost list. If match found,

SendGrid Dynamic Email Template won't pass data from .NET

I'm trying to use SendGrid's API to send Data to a Dynamic Template, and send that email to a customer. However, the email sends, but the data is never passed.

how to find out textbox value is greater than datagridview cell value in c#

i have a numeric value in textbox which is retrieve from sql database, meanwhile i have unbound GridView with some rows. now i want to compare the textbox v

Where should I put this object property/attribute

I am creating a testing program. The three main objects I have right now are Tests, Questions, and Answers. I have three tables in the database, tests, question

How to resize multidimensional (2D) array in C#?

I tried the following but it just returns a screwed up array. T[,] ResizeArray<T>(T[,] original, int rows, int cols) { var newArray = new