Category "c++sharp"

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

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