Access the list of data from another function
I have created a function for reading the data from excel file and stored as a list by rows and columns. Now I want use or access the data from the list to another functions using C# ```csharp public ...
- Modified
- 14 May at 06:13
How to create multipart/related request in ASP .NET
SOAP server requires request with multipart/related content type. C# Code: Which creates a request with content type multipart/form-data , but how to create multipart/related request?
- Modified
- 14 May at 06:15
How to write integration test for SignalR
I use SignalR in my Web API. How to perform integration testing on it? I do not want to mock Hub I want to work on real instance of connection and check the results. Currently I have something like th...
Adding Conditional HTML Ending and Opening Tags in .NET 8 Blazor Page
I am trying to find out what the recommended approach is for adding conditional closing and opening tags HTML into a .NET 8 Blazor Page such as to equally split up database records into 3 `` tags when...
- Modified
- 14 May at 06:17
Will the C# compiler optimize away the re-evaluation of expression-bodied members?
If I write the following for a class member definition: My understanding is that the expression gets evaluated every time the member is accessed, so a new instance of `List` will get created each time...
- Modified
- 14 May at 06:18
you should return the most specific type and accept the most generic one?
Many developers recommend: > you should return the most specific type and accept the most generic one I need to return customers for frontend to display them. Let's say I will use the class below in a...
- Modified
- 14 May at 06:20
With a Source Generator, how to generate source using an aggregate of all transformed nodes?
Using a Source Generator, I want to generate a single file that is built using an aggregate list of all the transformed nodes (instead of one at a time). I'll use an Enum-based example as these are co...
- Modified
- 12 May at 04:18
Where to save access token with cookie authentication
I'm working on a project where I was mandated to save access_token and refresh_tokens inside the cookie as file/database written was prohibited. Please do not go into the mute discussion of better app...
- Modified
- 12 May at 04:19
Best practice regarding code in constructor for initializing in C#?
I am learning C# and learning about classes, and I have a question regarding best practices in class initialization and constructors. For instance, I was doing a practice exercise from Player's Guide ...
- Modified
- 12 May at 04:13
EF Core transactions
There is probably already a good answer to this topic somewhere, but would love if you could help. I don't understand the point of using explicit transactions in ef core, for example: what was the pro...
- Modified
- 12 May at 04:15
What is the recommended way for using AddIdentity and AddMicrosoftIdentityWebApp together in an asp.net core mvc application?
We're creating an application where the user can log in using username/password or as an alternative use an external IDP like Microsoft Entra. Before support for the external IDP was added, the applic...
- Modified
- 12 May at 04:23
How do i get a useful median for 3D positions?
I have made a useful median for 2D positions by taking the average median of the x positions of the positions rotated in every 360° direction. The angleDiffs are the degrees of freedom, that the rotat...
How does UseRandomizedStringHashAlgorithm help against hash flooding attacks?
I read this [article][1] about `GetHashCode()`. It talks about how randomizing the hash function can help prevent hash flooding attacks. Stephen Toub also said in a [comment][2], the reason to use a r...
- Modified
- 12 May at 04:24
Linux compatible .net 8.0 high precision fixed timer
I've been trying to implement a higher precision timer to my C# Raylib game project for running at fixed intervals regardless of the game's main drawing loop. My current implementation is using `Syste...
How to listen to an event in a separate class
I am new to C# and I have a question about event handlers and how to listen to one from another class. See the pseodo code below. I created two classes. I have one class that has an event, and one tha...
GameObjects fall downwards in Unity when they should MoveTowards spaceship
I'm making my first C# game/program with Unity. Basically, the meteoroids should move towards the spaceship but they lose velocity and start falling downwards. The code below worked before I added the...
- Modified
- 12 May at 04:26
How to open the File Explorer at the push of a button in a C# Windows Forms App?
I'm making a To-Do List using Windows Forms, and currently I'm working with MS Access. And I need help on how to open and Access file in the file explorer upon the push of a button. Here is my code: U...
Finding all event handlers in user controls
I have a function in form1 and it perfectly works for finding `ButtonName_click` event handlers in `form1`. However, it can not find event handlers for buttons in user controls. this function is in fo...
C# can't convert from string to runspacemode?
So writing a C# program that uses a powershell script as follows Although, doing this generates the following error: > Error CS1503 Argument 1: cannot convert from 'string' to 'System.Management.Autom...
- Modified
- 12 May at 04:31
Resolving Color Inconsistencies and Accessibility Issues with Razor Components in .NET 6 Project
I'm conducting research to solve an issue in my .NET 6 project. I'm experiencing some inconsistencies and color problems in Visual Studio regarding a razor library I've added to my main project. Speci...
- Modified
- 12 May at 04:32
Use @ literal in SQL command text
I want to change a password for a user in MySQL which requires `@` symbol. However, C# SQL command uses that as a parameter holder and because of that the following command fails. How does one escape ...
Can C# help me write an immutable class that uses "With" member functions that return modified objects?
I have an immutable class defined with around six properties. This is a simplified version: This allows me to write code such as: and extension functions allow me to write more useful "With" functio...
- Modified
- 12 May at 04:33
What regex pattern can I use to work with ISBNs?
I require a pattern that will search for the correct ISBNs in the file. Only the pattern itself needs to be implemented using regular expressions My code so far:
How can I detect if a column is hidden in Google Sheets?
I have a sheet where certain data is hidden and I need to ensure that I don't show that data if it's hidden (which columns are hidden will change frequently). How can I detect which columns are hidden...
- Modified
- 12 May at 04:36