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 .NET, .NET Framework, .NET MAUI, 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
0 answers
6 views

How to speed up the screenshot in c#

Basically i'm trying to make the screenshot function faster, because it only gives me around 230 iterations/s, but i have to make it faster than 1ms (over a 1000 iterations a second), is there a way i ...
Xinon's user avatar
  • 1
0 votes
0 answers
10 views

The project is not going to unity

Подключил БД к проекту юнити и теперь при сборке выдает ошибку:" ArgumentException: The Assembly Google.Protobuf is referenced by MySql.Data ('Assets/Scenes/MySql.Data.dll'). But the dll is not ...
Dima's user avatar
  • 9
-1 votes
0 answers
15 views

Advent of Code 2023 - Day 1 - C# Wrong Result - Tests are passing

I started Advent of Code yesterday (Day 1). I did a test driven development approach. I passed the first step, but don't get the correct result on the second step in C#. Reached limit for text, so I ...
liqSTAR's user avatar
  • 1,253
0 votes
0 answers
19 views

Program exits with an error when using AOT Compilation

I have a C# .NET 8.0 WinForms project that is set to compile with AOT. The problem I'm having is after I compile and delete every file in the output folder my program runs just fine without any ...
Barni's user avatar
  • 1
0 votes
1 answer
12 views

Networking in c# with a single computer

I am trying to make a program that connects to another computer to be able to trransfer files directly in c#, nothing fancy. Since I kinda of am a begginer (started to learn how to code in the ...
Rafin's user avatar
  • 1
0 votes
0 answers
8 views

Problems with adding wishlist in .net+blazor ecommerce app

`In swagger the wishlist is retrieved,items are added and deleted succesfully but when i press the button on product page nothing happens WISHLIST SERVICE ON SERVER namespace BlazorEcommerce.Server....
alexis's user avatar
  • 1
0 votes
0 answers
6 views

Video and Screen sharing with agora not working when VR headset connected in Unity

It is the same code as the code you get following the video sdk docs when implementing broadcast streaming for unity. Both video and screen sharing is working when using 2 computers. However as soon ...
Jonatan's user avatar
-1 votes
0 answers
35 views

EF Core with many-to-many relationships - ...key value '{Id: 19}' is already being tracked

I have several complex objects with many-to-many relationships. And i can not to modify them. public class ProductEntity { [Key] public string Nomenclature { get; set; } public List<...
boraicho's user avatar
0 votes
0 answers
8 views

Unity Earth Height Map Mesh

Trying to create a mesh that uses heights from an earth height map, but running into a couple of issues. Height map from https://en.wikipedia.org/wiki/Heightmap#/media/File:World_elevation_map.png ...
joshy.poo's user avatar
  • 593
-5 votes
0 answers
19 views

I want to create add-on at adobe pdf using C# [closed]

I want to create add-on at adobe pdf using C# there any guideline to starte to implement , i trying to download the SDK for adobe Acrobat, there isn't direct link to download it , if any developer ...
Risk's user avatar
  • 93
-1 votes
0 answers
21 views

Original object being changed after changing clone

I have this algorithm to do something similar to the Dijkstra city problem but for some reason every time I change the current city object it also changes the starting city even though I'm not copying ...
Gringot's user avatar
-1 votes
0 answers
11 views

Unity rigidbody position y moving wrong

If you need other information, try to use this game's repo and check branches. Duplicate with Github I set rigidbody at dynamic mode and set interpolorate as extrapolate. My first code was: using ...
Daumss's user avatar
  • 1
0 votes
1 answer
27 views

Add two matrices

I have a problem "Index was outside the bounds of the array." and can't understand where is a problem static void Main(string[] args) { Console.WriteLine("If you want add elemenets of ...
Evgen Petrun's user avatar
0 votes
1 answer
39 views

Count words in text

I need to count the number of words and the number of unique words from a UTF-8 text file, the text can contain any language. I tried the next option, but I get more words than in Word or online ...
Михайло Куриця's user avatar
-2 votes
0 answers
27 views

C# - change in one object's variable leads to change in another object's variable

I'm a little confused by an 'error' I've come across while working with objects in c#. I have written code, that creates objects from two classes based on a JSON. The two classes are 'malo', and 'bttp'...
nico's user avatar
  • 1
-1 votes
0 answers
19 views

Looking for cleaner way to handle a potential nullable conversion to generic type

Here's my code: PropertyType GetSamplePulledDate<PropertyType>() { DateTime? date = String.IsNullOrEmpty(PropertyEditor.DtPckerSamplePulled.Text) ? null : ...
Johnny Wu's user avatar
  • 1,333
-4 votes
0 answers
57 views

String interpolation problem in C# asking for ;? [closed]

string inter polation asking for semi colon I was doing the Microsoft C# program when I was using the $ sign as I had been doing till now but now it is not working and cannot really figure out why. I ...
guilty snake's user avatar
0 votes
2 answers
36 views

In C# regex, how do I optimise matching a sub-sequence of characters

Given a string input, I want to use C# regex to match part of the character sequence, but in order, from start. The following inputs will all match: t tr tru true The following inputs will not match:...
Ahmed Elsawalhy's user avatar
0 votes
0 answers
34 views

How to have a design instance of a viewmodel by deserialisation for a UserControl?

I have a UserControl with a view model: public partial class FarmLogPageView : UserControl { public FarmLogPage? ViewModel { get => (FarmLogPage)DataContext; set => ...
Soleil's user avatar
  • 6,579
-6 votes
0 answers
30 views

Brackey’s save and load system issues [closed]

I’m making a Family fortunes game for my family for Christmas and for saving and loading the quizzes I’ve used the Brackey’s save and load system. This is the video. My code is exactly the same except ...
code_bean193935's user avatar
0 votes
0 answers
8 views

Unity C# - Issue with OnTriggerStay not being called consistently for colliders

I'm working on a Unity project where I have two game objects with colliders - one is a player character, and the other is a trigger zone. I've attached a script to the trigger zone object with the ...
RajatRaja's user avatar
  • 146
0 votes
1 answer
33 views

Enum is not populating with the right options in ASP.NET

I am new to ASP.NET and I am facing a problem that when I populate the enum as a list, it sets a default value and doesn't show the first option from the <option> tag as the start it shows it ...
Csh's user avatar
  • 3
0 votes
2 answers
56 views

How do child threads talk to the main (UI) thread in blazor webassembly (multithreading mode)

Referencing my old post; blazor webassembly multithreading mode update ui problem I am trying to use multithreading feature of blazor coming in .net8. Installed workloads and nugets as described. ...
Ender KARADAG's user avatar
0 votes
0 answers
18 views

How to publish a net cross platform application without rebuilding it and without restoring it?

I'm confused by all the verity of options I can use for net cross platform development. Let's discuss specifying runtime identifier(s) in a csproj file. Let's say there's a net6.0 project which is ...
isxaker's user avatar
  • 8,676
2 votes
0 answers
24 views

Improve Performance of initial page load time with Blazor Webassembly

.Net Blazor WebAssembly sounds really great. It can run fully client-side, meaning there is no need for a dynamic server and one can even host it on a CDN. Even better, it is possible to turn it into ...
dragon's user avatar
  • 1,220
1 vote
2 answers
45 views

c# Implicitly typed arrays behind the scenes

Can someone explain how the compiler proceeds here to find the "common" type (double). I assume the IConvertible plays a role here? private static void Main(string[] args) { var nrColl = ...
McFly's user avatar
  • 23
0 votes
0 answers
16 views

Reading string from Siemens PLC using s7.net pulls new data along with old leftover

i am using s7.net library to read string value from S7 1200 plc. it is reading data but incorrectly. For example if data is "My Name", it read it well When it is changed to "ABC", ...
Vikky's user avatar
  • 752
0 votes
0 answers
2 views

LibVLCSharp Media Player stops when app is minimized

I have a UWP Application. I am using a LibVLCSharp.Uno.VideoView and LibVLCSharp.Shared.MediaPlayer. I have a problem, when the app is minimized the player stops. I added a Background Media Playback ...
Denys's user avatar
  • 15
0 votes
1 answer
52 views

How to pass parameters besides injected services in constructor?

In constructor of Game class I am passing scoped service ISessionsRepository as injected service and other parameters. public class Game { private ISessionsRepository repo; public Game(...
Erray1's user avatar
  • 1
0 votes
2 answers
23 views

Newline in text, ASP.NET Blazor Razor pages

There is some text coming from a database and it showed on the Blazor Razor page as plain text. On the Razor page have set it to something like this: <p class="footText"> @...
Gerald's user avatar
  • 1
3 votes
1 answer
67 views

Why do C# 12 primary constructors execute in opposite order?

Why do primary constructors in C# 12 do execute in opposite order? That's kind of a breaking change to say the least... Example: namespace Whatever; [TestClass] public class UnitTestTemp { [...
aybe's user avatar
  • 15.7k
0 votes
0 answers
6 views

How to prevent system notifications (of all apps) from showing up during screenshare in Windows?

I'm using a UWP app and following the screen capturing as mentioned in the https://learn.microsoft.com/en-us/windows/uwp/audio-video-camera/screen-capture As a part of privacy, how can I ...
Karthik's user avatar
  • 95
0 votes
0 answers
18 views

Getting "Error HRESULT E FAIL has been returned from a call to a COM component," while creating ASP.NET Web application

My Visual Studio version is community 2022. I was expecting that my application should be created. I tried following solutions : deleted all things and reinstall the application but didn't work Tried ...
umer shaik's user avatar
0 votes
0 answers
19 views

How to download files to client machine in C# ASP.NET Core

I have a method that converts files and downloads them as expected when on localhost. However when this application is deployed I see that the files are downloading to a location on the server instead ...
Zidane's user avatar
  • 1,804
0 votes
0 answers
27 views

How to call a method of scoped service from a class located in it?

I have a scoped service, containing concurrent dict of Game instances. In game class there is a method "updateSession", which has to call an "Update" method of scoped service ...
Erray1's user avatar
  • 1
0 votes
0 answers
14 views

Circle center & radius detection at OpenCV

I want to detect circle center & radius. ( C#, OpenCV2 ) I tried to find it using Canny Edge, Laplace Edge, BinarizerMethod. I found wrong position and radius. How can I improve it? a_circle = new ...
jaebeom lim's user avatar
-1 votes
0 answers
30 views

character stuck in one place

when i am playing the game after some time it gets stuck in one place and animation is in loop it goes back to play that animation in loop and then when i press jump button after playing jump ...
Arjun Aswal's user avatar
0 votes
3 answers
59 views

Looping a bool question and returning to main method

I'm trying to check an input is valid from a method call. I then need that method to receive input, confirm its either true or false. If false it loops and ask for the input again, if true it returns ...
Don Boss's user avatar
0 votes
0 answers
20 views

How to List clusters by subscription ID using .NET?

New to Azure SDK for .NET, can someone help in providing on how to list all clusters in a subscription using subscription ID only. I am trying to bypass using Resource Group to save time. Previously ...
Mudit Balooja's user avatar
0 votes
2 answers
30 views

MAUI XAML - Can't reference property value of custom control nested inside another custom control from outside

I would like to set the Text property from MyCustomContentPage in XAML: File 1: <Grid x:Name="MyCustomControl" x:Class="MyCustomControl"> <Label Text={Binding Text} /&...
Sebastian Reyes's user avatar
1 vote
2 answers
59 views

Trying to create a C# program that uses auto-implemented properties, overrides ToString(), and uses a child class

I'm going to try to be as clear as possible, but bear with me. I need to make a program that: Create a class named LetterDemo that instantiates objects of two classes (named Letter and Certified ...
gabbi368's user avatar
0 votes
0 answers
31 views

I have an issue in my C# application and get an exception

I am using two package afroge and ozeki. In form load of afroge, when I click on the device's button, I want to load the Ozeki and capture a picture. After capturing the picture, it should load in the ...
Babar Ali's user avatar
  • 143
0 votes
0 answers
9 views

Blazor Server cannot find static assets of an RCL

I have a Blazor server project that has an RCL: When I run this project from Visual Studio Preview, the app runs fine. If I publish the project to a folder, the app cannot find static assets of the ...
Mayur Ekbote's user avatar
  • 1,804
0 votes
1 answer
33 views

How can I change the background color of the title bar in an android emulator in VS 2022

I'm writting a .NET MAUI solution that is suppose to run on android, and currently has two pages. When I start it up the program runs fine and looks like this: I also added a Flyout menu which I ...
BobG's user avatar
  • 1
-3 votes
0 answers
24 views

I'm getting a Json response but can't read it, escaping? [closed]

C# I give a simple request, but I get this response. I think the whole example is not necessary, everything seems clear. And I think this is a shielding problem. HttpResponseMessage response = await ...
Vladimir's user avatar
-3 votes
0 answers
45 views

How to find in source code the context menu to add missing icons?

I'm trying to add icons to the default context Menu using Scintilla Source code from https://github.com/jacobslusser/ScintillaNET I've tried to add my own but default context menu is displayed. I've ...
user2180706's user avatar
0 votes
0 answers
18 views

Dropdownlistfor Selected Value not binding

The user has already chosen the product, version, and module in this edit form. The product and version work together flawlessly, but I need to shows user selected one. The Selected attribute has been ...
Mohamed Asan Sali's user avatar
0 votes
1 answer
18 views

Linux: convert pfx to snk - or: How to Strong-Name an Assembly

I am on Linux. The platform is a devcontainer, so the underlying os might vary. I am using dotnet build to compile a .csproj project. (The .csproj is in the new sdk format.) I need the resulting ...
Sebastian Meine's user avatar
0 votes
1 answer
19 views

Not able to view table contents in Datagrid

I've created a C# Windows Forms project in Visual Studio for an inventory platform. I've set up a DataGridView and a local database, successfully connecting them. While I can see the entire table ...
Anu Fathima's user avatar
0 votes
0 answers
13 views

How can I make Oracle session time length limit with ODP.NET C#

I want to know how to Oracle kill session in limited length of time on ODP.Net. Thease are what I tryed. 1.I made Oracle user profile set CONNECT_TIME = 1 min. 2.I made Oracle user with this profile. ...
masaya hakamata's user avatar

1
2 3 4 5
32151