We changed our privacy policy. Read more.

Questions tagged [c#]

C# (pronounced "see sharp") is a high level, statically typed, multi-paradigm programming language developed by Microsoft. C# code usually targets Microsoft's .NET family of tools and run-times, which include the .NET Framework, .NET Core and Xamarin among others. Use this tag for questions about code written in C# or about C#'s formal specification.

Filter by
Sorted by
Tagged with
0
votes
0answers
2 views

Is it possible to log into Azure from my .net core app using just user and pass?

I'm trying to log into Azure from my application to get some blob from Azure Blob. The Azure.Identity nugget package has some methods for that, like some TokenCredentials class and, what I wanted to ...
0
votes
0answers
2 views

xUnit multiple levels of collection fixtures

We are currently migrating NUnit tests over to xUnit. In our previous tests, we had multiple levels of test bases: public class TestBase{ //Example protected ICacheManagerFactory ...
0
votes
0answers
5 views

Forward multipart/x-mixed-replace live stream ASP.NET Core

I've an ASP.NET Core server that, upon client request, start fetching a stream from an AXIS camera and returns it to the client for displaying. If the http request to server is made directly by the ...
0
votes
0answers
9 views

How to set DateFormat of DateEdit in Blazor?

I am using the following code for the Date field in Blazor : <DateEdit id="dateOfBirth" TValue="DateTime?" Class="form-control" Date="BiographicalInformationData....
0
votes
0answers
4 views

Receive messages using masstransit from Azure Service buss linked with RabbitMq via shovel

I linked rmq instance and azure service buss via shovel and use masstransit for send/receive messages. I can successfully send messages to rmq and see it in service buss as well but can't receive ...
-1
votes
0answers
7 views

Why does "IQueryable GetData<subclass>().Where(...)" not find anything in the "Mainclass" table?

I have a main class, and a subclass who inherits from it. I have an SQL Server DB, only containing the main class. This piece of LinQ-based source code is not working: Subclass s = Database.GetData<...
0
votes
0answers
10 views

Moq: Mocking an interface of abstract base class of a controller

My problem: I want to unittest a controller. This controller has a constructor that includes a repository. Repositories are named like SomethingRepository. SomethingRepository inherits from abstract ...
0
votes
0answers
6 views

How can i use datatable ajax with asp.net?

I want to list the data I pulled from the database with datatable ajax. This is exactly what I want. When there are too many records in the database, listing them can delay the page load. It divides ...
0
votes
0answers
8 views

How to mock the _elasticClient.DocumentExist function?

How to mock the below function in elastic search with NEST library.? var response = _elasticClient.DocumentExists<Organization>(id, d => d.Index(index));
0
votes
1answer
34 views

why do we use KeyValuePair keyword instead of Dictionary<tkey,tvalue> keyword as the type in foreach loop?

am just learning c# and wanted to use the type instead of var in foreach loop while using the dictionary, but it gave me error when i used Dictionary Dictionary<int, string> names = new ...
-2
votes
0answers
15 views

How do I get the output result from a specific argument?. C#. Process [closed]

How do I get the output result from a specific argument? Process process = new Process(); process.StartInfo.Verb = "runas"; process.StartInfo.WorkingDirectory = @"C:\Program Files\...
1
vote
0answers
7 views

Switch DetailsTemplate in ListDetailsView between view and edit mode

I do have a ListDetailsView showing some data (lets say Company as a simple example here). Normally the details of a Company are shown as readonly. However, via the ListDetailsView.DetailsCommandBar ...
0
votes
1answer
10 views

Semaphore ConnectionThrottlingPipeline for MongoDB c#

I am trying to Implement a pipeline to limit and execute all incoming request from API to mongoDB using this reference. I Have Implemented as Follows, Singleton.cs using System; using System....
-1
votes
1answer
21 views

Show Form by Button

I want to make a Management Application with a WinForm and i want to Display one Login Form and when the Login Button is clicked, the second Form should appear. I tried this: MainProgramm.BringToFrot()...
-3
votes
0answers
14 views

Date Difference in Years, Months, & Days in C#, ASP .NET [duplicate]

I am developing an application portal and it has a section with previous work experience. I want to find the difference between starting and ending dates of the user at a previous job. I am unable to ...
0
votes
0answers
13 views

Design Pattern for connecting to Hardware

I have a C# software application that collects data from various hardware and performs live data analysis on it before uploading to a database. I have created an abstract Device class with a concrete ...
1
vote
0answers
22 views

Read first 100 rows from Parquet file in C#

I have these huge parquet files, stored in a blob, with more than 600k rows and I'd like to retrieve the first 100 so I can send them to my client app. This is the code I use now for this ...
0
votes
0answers
15 views

Force windows to read values from the registry without rebooting and entering / exiting in C# code

I am trying to change the mouse cursor icons by setting new paths for parameters in the registry. But they do not take effect immediately. Only after reboot or login / logout. I know I need to use the ...
0
votes
0answers
8 views

Print multiple page in stimulsoft

I designed a stimulsoft template with 2 pages, actually this a design for personal card which front of card has some information like (name, family, personal code, position) and behind the card has no ...
3
votes
1answer
64 views

What does question mark after reference type parameter

What is the purpose of question mark after reference type parameter of method? I.e. one of constructors for OverflowException contains string? and Exception? parameters. public OverflowException(...
0
votes
1answer
43 views

C# select SQL query with parameter

I would like to migrate database from MS Access to SQL Server and I'm trying to modify my SQL queries. In MS Access they worked. I have this C# code: private DataSet GetIncident_ByIncident(string ...
0
votes
1answer
17 views

Changing materials properties during runtime

I am trying to alter my HDRP Lit material's emissive color and emissive intensity but it does not get reflected on my gameObjects. I have even tried using "_EmissionColor" and still there ...
0
votes
0answers
13 views

Adding selected items from Datagridview to a list collection

I'm having a trouble adding selected elements from a DGV to a model class type list , the constructor contains 10 parameters according to the image describing the DGV , the C# code is the following : ...
-1
votes
0answers
20 views

Unit of work fails to see second repository [closed]

I'm trying to implement a unitOfWork with a .net 5. Problem is my UOW only sees one repository. The Code: public IWriterRepository Writers { get; private set; } public IArticleRepository Articles { ...
-1
votes
0answers
25 views

How to make a breadth crawl [closed]

I'm solving a problem with CodeWars. And there was a problem that I can't solve in any way, namely, I'm doing something wrong when crawling, but I don't understand what in any way. https://www....
-3
votes
0answers
11 views

Getting the date using the yesterday label [closed]

Is there any way to get yesterday's date, if I enter "what is yesterday's date?"(In this case, the answer must be '03-10-2021') in C#. Thanks in Advance.
0
votes
0answers
10 views

Is there a way to queue animation with Playable API in Unity?

I'm trying to play many animations one after the other in order to sava data on a JSON. I can successfully play one animation through the Playable API, this is my code right now: public class ...
0
votes
1answer
11 views

How to get the position of the default vertical scroll bar in winforms textbox

I need to get the position of the default vertical scrollbar in a winforms textbox. So far i only managed to find a way to get the position of a custom scrollbar, but not of the default one created ...
-4
votes
0answers
20 views

Create Webservice and return string [closed]

I want to create a webservice where i could use 2 paramaters in url and get a string. Example: http:/localhost/ws/example/2/2 and this WebService return a sum.
-2
votes
0answers
20 views

Linq: GroupBy not show result for the .Include clause

Why in the result "Titolare" is null? If I don't use GroupBy, "Titolare" has value. Thank you. var ben = context.Benefici.Include("Titolare").Include("Titolare....
0
votes
1answer
29 views

SQL DataReader into Arrays

//request.Data = new double[] { 221, 428, 492, 471, 413, 344, 294 }; -->Dummy Data requestReport.Data = PurchaseSpProvider.GetRequestReportData(); public static double[] GetRequestReportData(...
0
votes
0answers
13 views

Changing Code within Region Trivia With Roslyn

How can i change code inside a specific region using Roslyn? I want to be able to going from this code: #region Constructor /// <summary> /// Constructor /// </summary> ...
0
votes
0answers
21 views

Using 2 SQL queries: get the output in Postman as one object

I have an issue regarding the fact that I have 3 tables where I need to collect data from. These 3 tables have 2 crosstables as well where they have a connection. Something like this: Table1 ...
0
votes
0answers
9 views

How could I overwrite this DataGrid style property in MaterialDesignThemes?

I'm using material design in XAML, I have a DataGrid, and when a row is selected and the mouse leaves the row then the row's background changes to white, if the mouse returns it changes back to the ...
-1
votes
2answers
43 views

How to let a user add new objects in a list?

In my Console App the user can currently add a new object by pressing the "+" key, but how can I let him later on change a specific object in the list? For example. The list is of boats. I ...
1
vote
0answers
35 views

Store Japanese text in variable

After a bit of the google, I was able to figure out how to print out Japanese characters to the console with Console.OutputEncoding = System.Text.Encoding.UTF8;. I was hoping I'd be able to input them ...
-2
votes
0answers
10 views

C sharp in Xcode

I'm a bit of a noob when it comes to programming. and I'd like to look into c# but stock Xcode doesn't seem to support it. does anyone know a way of adding support? the last thread I could find about ...
0
votes
0answers
8 views

how to solve 3d cardinalcommerce problem when cmpcdotnetcore is not available

There is a client's project in which I am working in which "cmpcdotnetcore" package is already in used but now this "cmpcdotnetcore" package is not available on the internet is ...
0
votes
0answers
16 views

System.Net.Mail.SmtpException in windows server

I have a mailer Code that is to be deployed, previously in the company we used to publish in AWS servers now we are supposed to publish in windows server,the code throws these exception when i run it ...
3
votes
2answers
72 views

What is new without type in C#?

What is new without type in C#? I met the following code at work: throw new("some string goes here"); Is the new("some string goes here") a way to create strings in C# or is it ...
-1
votes
3answers
42 views

Async method doesn't return string as expected [duplicate]

I'm quite sure this was answered but I can't find it into SO. I want to return a string from my async method, but it returns "System.Threading.Tasks.Task`1[System.String]", not the string ...
0
votes
1answer
21 views

Parquet ReadAsTable() method takes too long for big files

I have this code snippet: private Table getParquetAsTable(BlobClient blob) { var stream = blob.OpenRead(); var parquetReader = new ParquetReader(stream); return parquetReader....
0
votes
0answers
15 views

How to customize the Windows MediaPlayer GUI

I have searched for different ways to play videos in c#. All I got was Windows MediaPlayer and DirectX SDK which no longer works. So I want to use the Windows MediaPlayer but is there a way to remove ...
0
votes
0answers
13 views

How to publish an organization repository in Github with VSCode

I have a question with github. I created organisation repostory on Github with name TestOrganisation. However, VSCode sees the repositories in my personal account every time. How can I do the first ...
0
votes
0answers
19 views

The instance of the entity type cannot be tracked because another instance with the same key value pair for{'Id'} is already being tracked

I know that this question has been asked several times and mostly people are directly suggesting solution to the code piece asked in the question but I really wanted to know the core reason behind ...
0
votes
0answers
33 views

Dependency Injection - Resolve type without implementation

I'm trying to create a generic factory for my repositories in an ASP.NET project. Repositories take extra parameters in constructor, so they cannot be instantiated via dependency injection. In my ...
0
votes
1answer
23 views

How to Add server certificate custom validation

I have to issue when I am calling external service I have the following error The SSL connection could not be established, see inner exception. after long search I find that I have to add ...
0
votes
0answers
7 views

How to convert from Microsoft.Sharepoint.Client.ListItem to Microsoft.Sharepoint.Client.File?

I am trying to convert Microsoft.Sharepoint.Client.ListItem to Microsoft.Sharepoint.Client.File I have tried listItem as Microsoft.Sharepoint.Client.File and (Microsoft.Sharepoint.Client.File)...
0
votes
0answers
15 views

AspNet Boilerplate "Application is shutting down..."

We are working with a client project that uses AspNet Boilerplate framework. There is an odd behavior there, where if the app is started in debug mode, it outputs the text "Application is ...
0
votes
0answers
14 views

How do I create signed string token using SHA-512 and private key stored in pem

To make request more secure, I want to generate a token for the request. This token will be passed as a header in the request that will be hitting external service where this will be verified. The ...

15 30 50 per page
1
2 3 4 5
30002