11,304 questions with C#-related tags

Sort by: Updated
3 answers One of the answers was accepted by the question author.

How to return from async Task method?

My method is async Task like following. public async Task MyMethod() { string[] lists = GetCustomerLists(); foreach (string lst in lists) { // do somethong // if meet some condition to return ???? } } What is the…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2022-05-02T15:09:42.517+00:00
JeffinAtl 161 Reputation points
edited a comment 2025-02-21T20:39:21.8066667+00:00
Greg 1 Reputation point
2 answers

Why in winforms, after form resize does 'screen.getworkingarea( this) .height' return the same value

Attempting to draw a grid on a winforms form. Draws ok. If I resize the form at all the screen.getworkingarea returns the original values and redraws the grid to the same size with the resized section blank. Having stepped through the code I can see…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-20T11:26:07.8533333+00:00
Peter Reilly 0 Reputation points
commented 2025-02-21T14:50:35.0833333+00:00
Peter Reilly 0 Reputation points
2 answers

Count odd and even number in single textbox in c#

As you can see the image above, they have random [02 04 01 03 05] numbers. Now if I click the button count it will count how many even number or odd number in textbox. I have a code but it not working properly. private void button2_Click(object sender,…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-21T14:07:26.5233333+00:00
YUI-012 140 Reputation points
answered 2025-02-21T14:40:38.52+00:00
KOZ6.0 6,580 Reputation points
2 answers

How can I determine which endpoint caused the health check to fail and what error message is being thrown by the endpoint?

How can I determine which endpoint caused the health check to fail and what error message is being thrown by the endpoint?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,788 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-17T09:36:49.2933333+00:00
Bharathi Hattikal 40 Reputation points
commented 2025-02-21T06:03:12.46+00:00
Bharathi Hattikal 40 Reputation points
0 answers

How to obtain access to 'HumanPresenceSettings. SetingsChanged'

The "HumanPresenceSettings" instance I returned through this method, 'humanPresenceSettings=await HumanPresenceSettings. GetCurrentSettings Asynchronous ()', can read the relevant settings. However, when I subscribe to 'HumanPresenceSettings.…

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,802 questions
asked 2025-02-17T07:55:28.4633333+00:00
charles yu 1 Reputation point
commented 2025-02-21T03:11:05.38+00:00
Junjie Zhu - MSFT 20,526 Reputation points Microsoft Vendor
1 answer

AppInstallManager error - UWP

Hello Hello. I have a sample UWP and the following code is getting error: private async void Button_ClickAsync(object sender, RoutedEventArgs e) { AppInstallManager appInstallManager = new AppInstallManager(); } WinUI works well.

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-17T19:10:40.33+00:00
Anderson Rodrigues Cavalcante 316 Reputation points
edited an answer 2025-02-21T01:58:52.25+00:00
Junjie Zhu - MSFT 20,526 Reputation points Microsoft Vendor
4 answers

Linq ThenInclude Where Problem

Hello, I am trying to get only IsActive=1 data with this Linq; _db.Orders.Include(d => d.OrderDetails).ThenInclude(v => v.Vendor).Where(o=> o.OrderDetails.Any(od => od.IsActive == 1)).ToListAsync(); But the query brings all the…

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,665 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2022-09-15T07:13:13.197+00:00
Cenk 1,026 Reputation points
commented 2025-02-20T15:16:53.1066667+00:00
Alex Baggett 0 Reputation points
1 answer

Another instance of an entity raises an error when update

In my ASP.NET Core 9 Web API and Entity Framework Core, I have a model class for a Client that has a relationship many to many with the model class Channel. public class Client { [Key] public long ID { get; set; } } public class Channel { …

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-19T21:40:19.15+00:00
Enrico Rossini 201 Reputation points
edited a comment 2025-02-20T07:30:36.37+00:00
Hongrui Yu-MSFT 4,365 Reputation points Microsoft Vendor
3 answers

How is it possible to implement a complete semblance of a console (online compiler) in win fomrs?

Good time! Faced such a task as implementing code execution as in a console application in C # (with classes, methods, the ability to read data, etc.). Everything went super until I started testing my application. The problem is that I can execute code…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,923 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-11T14:53:37.4833333+00:00
Efrem 20 Reputation points
commented 2025-02-20T03:24:14.08+00:00
Jiale Xue - MSFT 48,966 Reputation points Microsoft Vendor
1 answer

How to Detect Stylus Pen Sides (Pen Tip vs. Eraser) in WPF (C#)

Hello, I’m developing a WPF application in C# that interacts with a stylus pen on a Windows device. I need to detect which side of the stylus is being used—whether it’s the pen tip or the eraser side. Could someone guide me on how to achieve this…

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,828 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-06T04:36:22.5+00:00
Manjunath PM 0 Reputation points
commented 2025-02-20T01:06:37.82+00:00
Hongrui Yu-MSFT 4,365 Reputation points Microsoft Vendor
3 answers

Visual Studio for Linux?

Since Microsoft & .NET Team is pushing so hard in the cross-platform solutions, will the Linux community see Visual Studio run on Linux? Since it is a great IDE with amazing tools, some of us are wondering will we see it on our preferred OS? I'm in…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,447 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2020-11-26T16:30:15.073+00:00
Viko 241 Reputation points
commented 2025-02-19T23:42:13.4366667+00:00
Ashton Drye 0 Reputation points
8 answers

Microsoft.Data.SQLClient 5.2.0 fails to work with .Net 8

I am having issues creating a Class library with C# and .net 8 that uses Microsoft.Data.SQLClient. version 5.2.0 which states that it will run on .net 8 platform. Here is the code for the class library using System.Data; using…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2024-05-04T22:39:27.66+00:00
Moshe Yalovsky 5 Reputation points
edited a comment 2025-02-19T12:08:16.3433333+00:00
45306458 0 Reputation points
0 answers

How to fix the problem of controls disappearing from the screen design window.

I am using Visual Studio Community 2022 version. In the C# WinForm framework environment, when changing the position or size of the screen design window control, an error occurs where the control disappears. In that case, if I close and open the Form…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,923 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,447 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
10,802 questions
asked 2025-02-18T01:56:00.6033333+00:00
재웅 이 0 Reputation points
commented 2025-02-19T03:14:30.5666667+00:00
Jiale Xue - MSFT 48,966 Reputation points Microsoft Vendor
2 answers

How to open notepad on remote computer

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; using…

Remote Desktop
Remote Desktop
A Microsoft app that connects remotely to computers and to virtual apps and desktops.
4,726 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-11T08:11:09.79+00:00
MIPAKTEH_1 545 Reputation points
commented 2025-02-19T02:52:21.9733333+00:00
Jiale Xue - MSFT 48,966 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

Closed XML.Reports Function app file not saving

I'm trying to write a function app which generates a report using ClosedXML.Reports. The output template is quite simple and only uses the summaryabove template. The function app is able to create a text file and save it to blob storage successfully. But…

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,441 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-02T19:26:01.4633333+00:00
Archive1 20 Reputation points
edited the question 2025-02-19T01:45:07.6966667+00:00
Jack J Jun 24,801 Reputation points Microsoft Vendor
1 answer

My Create a bot template is not completeing

I'm trying to deploy a bot using the 'Create a bot' from Language Studio. I've followed all the instructions and it is just hanging. I've just upgraded to developer support is this it?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
Azure AI Language
Azure AI Language
An Azure service that provides natural language capabilities including sentiment analysis, entity extraction, and automated question answering.
458 questions
asked 2025-02-17T00:23:58.12+00:00
Mike Allen 1 Reputation point
answered 2025-02-18T16:54:44.13+00:00
Sina Salam 18,201 Reputation points
1 answer One of the answers was accepted by the question author.

I'm searching for a package that can detect the country of a contact number without Knowing the country code or default region, while also being cost-effective in c#

I'm searching for a package that can detect the country of a contact number without Knowing the country code or default region, while also being cost-effective in c#

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-18T06:51:38.2466667+00:00
Bharathi Hattikal 40 Reputation points
commented 2025-02-18T10:00:13.31+00:00
Bharathi Hattikal 40 Reputation points
3 answers

How to fix an OpenXml issue in Word interop (C#) concerning bullet lists

Here is a truncated OpenXml standalone package xml => it's a string returned by range.WordOpenXml that can be processed by the OpenXml SDK WordprocessingDocument.FromFlatOpcString. Below is a very simple bullet list (the xml has been truncated to…

Word
Word
A family of Microsoft word processing software products for creating web, email, and print documents.
960 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,277 questions
asked 2025-02-17T15:55:25.07+00:00
Gael 0 Reputation points
answered 2025-02-18T08:17:41.0833333+00:00
Jiale Xue - MSFT 48,966 Reputation points Microsoft Vendor
1 answer

Converting audio/video tracks to AAC format in C# app.

I try convert audio/video tracks to AAC format using qaac lib. In CMD it works and output information about progress of convertation. In my C# app it works too, but I can't get information about progress, i try use these events: OutputDataReceived,…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-13T09:39:31.6733333+00:00
Alexander Kvitko 41 Reputation points
commented 2025-02-18T06:23:27.49+00:00
Jack J Jun 24,801 Reputation points Microsoft Vendor
5 answers One of the answers was accepted by the question author.

Problem with SqlParameterCollection.Add method to make SqlDbType all NVarChar

I am trying to access a SQL Server table with a program created in C# to update and register data. I am thinking of parameterizing the query and using the SqlParameterCollection.Add method to create a SQL statement. In this case, if I set SqlDbtype to…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,447 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,490 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,304 questions
asked 2025-02-14T01:02:27.16+00:00
那由多 60 Reputation points
accepted 2025-02-18T00:00:24.55+00:00
那由多 60 Reputation points