C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

Async delegate causes WPF to freeze until search is done

I used delegates to implement async search in my program. I have a progress bar and a label that says "Starting Search..." that should be shown while searching. Currently, the wpf window freezes while searching, and the progress bar and label are not displayed. After the search is done, it'll update the label to show "Match is found" or "Match is not found". I implemented the same functionality using await, but I just can't figure out why I can't get it to work with delegates. I've been trying to debug this for about a week with no progress, so any help would be greatly appreciated Code: https://pastebin.com/tdxTWT8C...
No description

how to add sprite sheet animation in monogame

How do i add a sprite sheet with animation using monogame?

Unity - Reusable components, how?

Hey, I created a simple model in blender, exported it and doing some stuff with it now in Unity. So I have a .fbx file in my assets and my hierachy, added scripts and stuff to it and using it in other scripts. Now I'm thinking about having multiple objects. How would I this now? Would I drag the component into my assets folder - so create a prefab and then drag multiple items into the hierarchy again, or do you do that via code? Or even somehow else? The dragging seems kinda redundant to me somehow...

Prefix Suffix Leetcode Problem

I wanted to solve problem 1769 on leetcode on my own but i couldnt do it. Im learning prefix sum algorithm so i wanted to solve it with that algorithm. I've been looking at this solution for like an hour now and i still cant understand why it works. What does the "balls" variable track? I'd be really happy if someone could help me understand it. solution: https://leetcode.com/problems/minimum-number-of-operations-to-move-all-balls-to-each-box/solutions/4613483/c-o-n-using-prefix-suffix-moves-calculation/...

Determining Nuget Dependency Order

We're in the process of migrating a lot of custom libraries into internal Nuget packages. Hosting them on an internal server (proget). I'd really like to have a way of tracking which packages are dependent on which so that when I get ready to push out new versions, I can do them in the right (dependency) order. I don't necessarily have a single solution file that includes all the libraries, as new ones are periodically being added. Is there anything out there that can easily spit out a graph or list that tells me which packages in a Nuget repo depend on which other ones, and make it easy to find the "starting point"?...

VirtualFileResult has access to files outside of wwwroot.. sometimes?

both the url /File and /File/Index should be matched to the same actionmethod right? But only typing one of the URLs returns to me the .PDF file... when NEITHER of them should What am i missing?...
No description

[WORK IN PROGRESS]

I'm making this text-adventure game! here are the first lines of code: https://github.com/Grevox/Terminal-game...

✅ How should updating Database work with Kanban style app work?

I'm working on a Kanban style app to practice everything I've learned in .NET so far and i was curious how you would handle updating everything in the database. If you have 2 boards to hold items, and you are actively moving those cards between board A and Board B or reordering the items in each board, that would require an update each time, because you have to track the items current board and the cards order in that board. But it seems like madness to call and update everything any item is moved, so instead is it a better idea to instead call an update on a timed interval that updates the board and all items at that point in time??...
No description

✅ How to handle complex Include in EF Core

I have the following entity: ```public class PlanEntity : ISortable { public int Id { get; set; } public int SortPriority { get; set; } public string Label { get; set; } public string PlanId { get; set; }...

good GUI for a chess game?

i looked into XAML and it looks like a right pain to learn. godot i still dont understand how to use, havent looked into monogame. hit me with your best gui options for a chess game...

✅ Design patterns or tools to for a changing database?

Hey everyone, We have an EF core with Blazor project that is nearly ready for users to try out. My concern is how to update the database after reach release. Migrations will help with the database structure, but the existing data may need to be modified if a model changed. How can I plan to address this? My initial thought is to make a console app to update the database for me, converting the old models to the new ones....

Convert a Binary string to a file

Hello Guys, I created this code which convert a text file to be copied into a image field in SQL server FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read);...

I need help to fix my Unity #C script

Me and my friend were working on a 3D game on unity and it supposed to be an FPS singleplayer but we ran into a problem with our script to move the camera, when i try to move the camera left or right also the player moves, can anyone help me? (btw i just started using unity)

✅ Map json to a dto issue

I want to map my json to a dto this is my json! ```{ "contact": { "name": {...

Translating linq query into OUTER APPLY or CROSS APPLY

Hi, consider the following query ```c#  return await context.TextMessages.IgnoreQueryFilters().Where(x => x.TenantId == tenantId && x.CreationDate >= startDate && x.CreationDate <= endDate && !x.IsIncoming)      .Select(x => new TextMessagesForLaunchLeads...

any idea on how to turn this code into a desktop app ?

i ve seen some tutorials but some of them are just basically clicking apps or calculator makers, but the thing i codded is pretty obscure for those examples, so i am asking if someone can help me to turn this code into a desktop app

LaTex Notations

Hello, I would like to know if there's any way to display a LaTex notation into the output in the format that is converted into the mathematical equation view.

✅ OnParametersSetAsync() in a blazor component being called before clicking a button in Blazor app

I created a component in Blazor, a CourseList which has a Parameter of TermId its added to the Terms.razor page as such ```cs <button class="btn btn-primary" onClick="@(() => ShowCourses(term.Id))">Show Course List</button> <CourseList TermId="termId" />...