25,570 questions
-2
votes
1
answer
142
views
How to replicate pattern matching behavior in a C# 4 switch statement? Feature 'pattern matching' is not available in C# 4 [closed]
I'm getting a
Feature 'pattern matching' is not available in C# 4
error in my C# code. I'm using a large switch statement with multiple cases.
switch (Name)
{
case string a when a.Contains("...
0
votes
1
answer
80
views
How can we generate access token based on some Id along with emailaddress and password
Currently I am working on a task where I need to generate access token for a user based on user credentials(emailaddress and password) and some Id (e.g: subscriptionId ). As per my research there is ...
0
votes
1
answer
427
views
Serilog.Sinks.Email Send to pickup directory
Is it possible for serilog to send emails to pickup directory? I don't actually want to send emails right now it's just a POC.
Thank you
0
votes
0
answers
62
views
Gapping in Dynamically Created User Controls
I am trying to programically/dynamically create some user control, since there will be a variable number of display elements.
The following code makes something that looks like this:
This looks ...
0
votes
2
answers
146
views
Sum multiple numbers in C# Form Application [closed]
The function of the form is that if I put a number in the text box and click the add button, the label shows the number. Then, if I put another number in the text box and click the add button, the ...
0
votes
1
answer
56
views
How to include the file name and the file extension when using MemoryStream in blazor webassembly
Here is my code
getting the file from FileSelectFileInfo
public FileSelectFileInfo selectedFile { get; set; }
then if there is a selected file, i store it in the variable above
private async Task ...
0
votes
1
answer
65
views
General Guidance on How to Copy One Database Row to Another Using Razor Pages
I have an app where the user would like to be able to enter a record for a client and then copy that record to another client. I'm picturing doing this after the record is created and saved. Perhaps ...
0
votes
1
answer
89
views
Cloning an image file when pressing a button in a C# form application
I have an image box in the C# form application and I want to clone that image when I press it.I tried this code but I didn't get any results
private void pictureBox9_Click(object sender, EventArgs e)
{...
0
votes
1
answer
427
views
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed "
Getting an error while calling API from WCF service:
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed ...
0
votes
0
answers
116
views
Serialization and validation of multiple C# attributes (built-in and Custom) in JSON schema
I required a help on JSON schema and JSON validation where We have a requirement to have multiple attributes (built-in and custom) for a property in C# and then serialize them into JSON schema.
I am ...
0
votes
2
answers
259
views
can't enter "d" "e" or "f" with sendkeys on Safari 17.3.1
I'm using safaridriver, included with Safari 17.3.1 (19617.2.4.11.12). I'm not having problems with the latest versions of Chrome, Edge or Firefox.
I have a web page with just a textarea input. If I ...
0
votes
1
answer
43
views
Retrieve records of recently modified files among duplicates in same folder
Table
col1 col1 col3
filepath1 filename1 modified date1
filepath1 filename1 modified date1
filepath1 filename1 modified date2 <- latest in duplicates in col1
filepath1 ...
0
votes
0
answers
69
views
How to apply effect inside WPF UIElement OnRender method?
I want to apply a blurr effect to a specific geometry, inside WPF UIElement OnRender method.
I have code like below.
protected override void OnRender(DrawingContext drawingContext)
{
...
0
votes
1
answer
94
views
NUNIT test case for idbcontexttransaction
I am writing Nunit test case for the below. Here the IDbContextTransaction is from the Microsoft.EntityFrameworkCore.Storage library. Here the argument of DeleteDataAsync transaction is beling passed ...
0
votes
0
answers
101
views
Communication with "Async" Service in Complex System Architecture
In our system, we have around 16 microservices that communicate seamlessly using events through a message broker. These microservices use gRPC as their endpoint communication protocol, with an ...
0
votes
0
answers
67
views
why cast of user code and employee id failed on post action when click submit button?
I work on asp.net MVC web application . i face issue on RequesterIndex
action with type Post failed to cast user code to employee id .
action Requester index with type post fire when failed cast
and ...
-1
votes
1
answer
47
views
c# program to remove the given quantity in a collection of objects
I want to subtract the qtyordered (8) from the list of items quantity. I have the given list below and
Pen1 5
Pen2 6
Pen3 7
Pen4 8
I am expecting the output:
Pen1 0
Pen2 3
Pen3 7
...
1
vote
0
answers
262
views
How can I draw an error bar with +sigma and -sigma?
I have the following function that plots an error bar.
public void AddErrorBarsTwoSigma(string curveName, List<double> xValues, List<double> yValues, List<double> yErrors, ...
0
votes
0
answers
137
views
how to maintain scrollview position while updating collectionview in xamarin forms
Good evening fellow Samaritans
I need the collaboration of the community, I have a collectionview which I update every 3 seconds, but I need it to maintain the scroll position it had before updating ...
0
votes
1
answer
140
views
How to secure and retrieve string data with a consistent length using encryption and decryption in .NET
We aspire to achieve encryption and decryption in a way that ensures the length of the encrypted result aligns with the length of the original data. How can this objective be accomplished in .NET code?...
0
votes
1
answer
175
views
Creating SSIS Custom Component - PreExecute method cannot get connection manager
I had trying my hands on creating a SSIS custom component to retrieve data from Salesforce. I having the custom connection manager project working and verified, and the custom source works and ...
0
votes
1
answer
36
views
How do I create VBA code that is associated with a particular worksheet in C#?
I wrote a program in VBA a number of years that reads in files and builds a macro enabled spreadsheet. It works reasonably well. I am rewriting this code in C# with enhancements. The problem that I ...
1
vote
0
answers
138
views
How to get all tracklog of member in club (with name athlete and time start every run) Strava through API V3
I write a service get data from club Strava for Running Club. I want show on dashboard with some infor like that: fullname, distance, moving_time, elapsed_time, time start tracklog, ...
I call api api/...
0
votes
1
answer
285
views
Implementing Single CRUD operation for more than 30 of tables
One of my questions is closed due to insufficient information so I written another with detail.
I want to write a blazor app in c# & .netCore plateform using Visual Studio 2022.
Such app will be ...
0
votes
0
answers
63
views
Why when running yarn start, the css will changed?
Recently, I had changed my css font size from 0.875rem to 1rem. However, after I run the command yarn start for testing, it had changed back the font size to 0.875rem. Any idea how to solve it, else ...
0
votes
1
answer
71
views
c#- Every time a buttton is clicked related item (Button name as Bread) count should be incremented in Data Table row of data grid view
int bread = 0;
DataTable dt = new DataTable();
DataRow dr ;`
private void Form1_Load(object sender, EventArgs e)
{
dt.Columns.Add("Food");
dt.Columns.Add("...
0
votes
1
answer
66
views
refactor lambda expression as sonar showing as null on at least one execution path
I want to refactor this code as Sonarqube showing as 'bidRelations.Where(x => x.Type == _appSettings.ResType).FirstOrDefault()' is null on at least one execution path.
public new List<...
0
votes
0
answers
72
views
unhandled exception occurred during the execution of the current web request. Value cannot be null. Parameter name: propName
I am trying to build a database management system for legal department of a company using C# and ASP.net and SQL server
this is the load record method of the Case.aspx.cs used to load the gridview ...
0
votes
1
answer
611
views
Storing dictionary of dictionaries using JSON format in Unity/C#?
I am new to Unity and C#, most of my experience is in Python.
I need to store some data. For the sake of the discussion, let's imagine it looks like (and no, it does not look like json here, I am ...
2
votes
1
answer
410
views
Is there a way to list all rooms in a roomlist with C# Microsoft.Graph library?
I am creating backend service that is supposed to subscribe to Microsoft Graph API and receive notification whenever there is a new meeting scheduled in one of our meeting rooms.
I am getting all ...
0
votes
1
answer
40
views
Modifying object class while running the code
I have the following code running as it should (albeit not special), but I'm trying to make the number of columns defined to be variable. Ideally, this would be done right here in the class.
Is ...
0
votes
2
answers
311
views
extract data from List<List<T>> in C#
class FieldType
{
string Id {get; set;}
string dataType {get;set;}
}
class Field
{
int fId{get;set;}
string fName{get;set;}
FieldType fType{get;set;}
string data;
}
class ...
0
votes
1
answer
67
views
C# WinForms Panel with AutoScroll has dead space
I have a GroupBox, and inside that GroupBox is a Panel with properties:
.AutoSize = false
.AutoScroll = true
.Dock = Fill
.AutoSizeMode = GrowAndShrink
I create controls in that (Scroll)Panel at ...
-1
votes
2
answers
92
views
Part of input string to match with arraylist string
How to matches the string in a sentence with the array list string
Input - Machine Name is server1.domain.com
ArrayList of string - server1.domain.com, server2.domain.com, server3.domain.com
I want to ...
0
votes
1
answer
62
views
Forms controls two-way databinding to class properties has strange behaviour
To learn databinding I have a test-project with copied example code.
I have a test class with some properties and on a form I have some textboxes, that should be two-way bound to the class properties:
...
-1
votes
2
answers
66
views
How to add object values through list of strings in c#
i am working with a project and facing a glitch i have a list of string values and have one class object and want to insert data to that object based on the list of string values. I am facing index ...
0
votes
1
answer
78
views
How to get total element tag?
I have the list string with some tags is defined, I want to count how many total element in each tag.
<L1 //2 element
<L1 //1 element
<H1 content>
>
<L1 //3 element
<H2 ...
0
votes
0
answers
113
views
C# host a WPF application in Winform
I have to put a WPF C# application in an old winform hmi.
The wpf application must be contained in a panel. To do this, I create a new wpf application process and use the SetParent function to "...
-1
votes
1
answer
53
views
questions about C# .net installation and set up in visual studio code
PS C:\Windows\System32> dotnet new console
Template "Console App" could not be created.
Failed to create template.
Details: Error while processing file /content/ConsoleApplication-CSharp/...
0
votes
1
answer
1k
views
Looking for C# code to get details of Node and Pod that it is currently running on
I am writing with a request here, and It would be great if someone can share your thoughts about it from your experience.
Scenario - Consider we have a node as part of an AKS cluster and there are ...
0
votes
0
answers
38
views
MultiSelect List from UI to Model
i am presently working on an API to create form data. however one of the fields is Multiselect with options.
MY model looks like this
public record createAdmissionDto
{
public string Username { ...
1
vote
1
answer
741
views
How To Detect That Microphone Is In The Use Using C#
I have one UWP application in which I am trying to detect if microphone is used by any application or not.
Here is the code to get the microphone from my system.
namespace CallDetector
{
public ...
0
votes
1
answer
1k
views
Why doesn't DirectX work in Visual Studio 2022 when using .NET Framework 4.0?
I have a dll that uses .NET Framework 4.0 and DirectX and works and debugs fine in Visual Studio 2019. When I ported over to VS2022 DirectX no longer worked and the dll wouldn't load. I had to change ...
0
votes
0
answers
103
views
Resizing of tabpage content
I have a winform application, with multiple dockable forms.
In one of the dockable forms, i am seeing a resize issue of the content (described below), the document outline of which is as follows:
...
1
vote
2
answers
58
views
Distinct across different types of collection
Here's the object graph
public class Dto
{
public List<OrderTypeA> AOrders {get;set;}
public List<OrderTypeB> BOrders {get;set;}
}
public class OrderTypeA
{
public string ...
1
vote
0
answers
30
views
i want to enhance my controllers resizer code
it is not a problem , more of enhance.
i wrote this to control auto resizing controllers on windows forms form
but when maximizing, the gaps at height are grater that the ratio between old height and ...
0
votes
1
answer
128
views
Detecting Amharic Language using regular expression in C#
I'm working on a C# project that only accept Amharic language from the user and I want to use regular expression to evaluate the input.
This is the function that I found that works for Latin words. I ...
0
votes
1
answer
38
views
Fill the List of Expressions with the class properties based on list of string
There is a class Employee, defined below:
class Employee
{
public int Id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
}
and I need to fill in the ...
0
votes
1
answer
189
views
How to change DataTemplate depending on API in WinUI?
I have 6 DataTemplate for this API. API is a enum.
public enum ShimmerType
{
CirclePersona,
SquarePersona,
Profile,
Article,
Video,
Feed,
Shopping,
}
API name is Type. I ...
0
votes
1
answer
104
views
C# & WPF :: Loading window not updating as progress is made
so I am relatively new to the C#/WPF techstack.
I created a WPF program but sometimes the main window takes a bit to load and I am trying to add a loading window with progress bar but the UI is not ...