C#

C

C#

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

Join

the namespace is not recognised

hey so I am making a wpf app that will be a flight booking app but I will be storing user data on an azure sql database I am trying to create a REST API and so far I have made a ASP.NetService named FakeFlightBookingAPI I made this class named ApplicationDbContext to interact with my database here and I am trying ref my Admin and Customer classes that are part of my WPF project not my ASP project and my code is below ```cpp using Microsoft.EntityFrameworkCore; using FakeFlightBookingApp.Model;...
No description

ads for multi-platform avalonia (or Android at least xD)

Hi!, I'm very very new to all this xD and while I worked with WPF, this is my first time uploading something... So, I've made this Multiplatform App in AvaloniaUI, and I am focusing right now on the Android side of it, I'm about to publish (today hopefully) the app in the Play Store, but I have no idea how to add ads to it... I was thinking on a simple banner somewhere in the bottom of the app, so I can pay for servers/services and the app would be self maintained, but... all the explanations, tutorials, etc are targeted for Android specific platforms, which, I never used, so while Avalonia has access to this code implementations, I have no idea what half of what I'm reading means... As an example, admob has an SDK... in step one of the guide it sais "In your Gradle settings file, include the Google's Maven repository and Maven central repository" and then there are two explanations that say "Kotlin" and "Groovy"... I have no idea what ANY of this means, I tried finding what Gradle is, and seems like it is an actual file, which I also don't have in my project for some reason, I have no idea how to get or access those repositories, it mentions... I'm really lost, I've been trying to do this for a while now.. first trying to find an ad service which used paypal, cos I'm not from the US, so paypal was the best way of managing the exchange from dollars to pesos by myself, but I can't understand any of the different services explanations, they don't seem to focus on c# implementations on their mini guides... ...

โœ… Exception handling

I'm trying to understand exceptions but i'm having a hard time. So when an error occurs in my program. For example : ```cs int number = Console.Readline(); Console.Writeline($"{number}");...

Markdown editor without separate preview

Hey, so I'm planing on creating either a WPF or an Avalonia application, that serves as markdown editor (prefered avalonia, because of cross plattform). The markdown editor should be inspired by Obsidian or Notion, meaning you don't have a separate preview, but instead get the markdown rendered directly "block wise" in the same area where you can type. I first thought of having a textbox and whenever you press enter a new textblock gets rendered with the markdown converted to html for example. When you click on this textblock it gets converted to an editable textbox again. However with this approach I would loose all the features a single textbox has, like ctrl+z etc. Anybody has some idea how I could manage the live rendering of markdown?...

App Insights vs Azure Monitor (OpenTelemetry)

I am wanting to know what the difference is here, I was reading this document here. and was just trying to make sure I was understanding this correctly.
From my understanding this is just a different way of monitoring and logging based on the OpenTelemetry standard?...

Custom Memory Allocator

I need to manage millions of rather long lived (minutes to weeks) byte arrays that contain hundreds of KBs in memory. I need to be able to release the arrays if the memory pressure is too high and then reuse the RAM for arrays with other sizes. It is an in-memory database , which contains hot data from multiple TB of disk storage. Since a lot of IO is involved a lot of async functions are called and I can not make sure that the thread allocating is also the thread releasing memory. I think doing...

Im pretty new to c#

i wanted to make a progamm with no real purpose but even that i have not enough knowlage i wanted to make a program that does that: Progress bar when strarted random prograss labe that updates after reaching 100% chanching to form2...

โœ… array of methods

i am trying to create an array of methods, and those methods have parameters. is it possible to create an array with methods which may have 0, 1, and 2 parameters? they also have return values, and are meant to return ints when called
No description

ASP.NET Data Error

Unable to fix this error
No description

Null Literal and NUll reference problems

Hey guys, Beginer at using Files here. Im running into 2 errors while trying to read the contents of a text file, then putting the contents into a consructor....

Mercado Pago integration in .Net Clean arquitecture

Hey, i need help to implement mercado pago sdk in my back end proyect. If anyone knows how to do it I would appreciate his help.

โœ… How does the button know what to do?

Hey, new to C# and wrapping my head around following MVVM. Can someone help me understand how the button knows what to do here? When adding a new button or data binding, they all trigger each other (if that makes sense...). Will any button trigger all data bindings unless otherwise set with like a command relay or something? XAML: ```xml <TextBlock Text="{Binding DisplayText}" Background="LightGray" Margin="10"/> ...

question on complexity of a game

I'm new to c# but not really programming as a whole? And I'm gonna have to design a program of sort for a school project very soon (a long term one, that takes about 1.2ish years to complete) and I was just wondering if I'd REALISTICALLY be able to design a game with its own physics engine from like february, in a year.

[solved]Stuck on a The input is not a valid Base-64 string error

Here is the full error message: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. The error shows up when I use my login endpoint when _signInManager.CheckPasswordSignInAsync manager is called. ```...

What project type to choose, VS

Hello, I'm very new to C#, currently studying it on school, and I can't choose the right project type for my work. We have 12 different exercises that need to be done in one project, I've tried doing a Console App project but since I need multiple files, I need multiply for loops and mains and it doesn't let me do more than one. I've tried a Class project as well but it doesn't debug because its a library. What project should I choose?...

ObeservableProperty onChange is called twice?

I am using the avalonia mvvm project. in my ViewModel I have this part of code: ```c# public ObservableCollection<MarkdownBlock> MarkdownBlocks { get; } = new ObservableCollection<MarkdownBlock>();...
No description

How to formate code in Visual Studio?

I press the button or shortcut to format Document and says it's ready, for me it's a big mess. I would like a linter for everyone who's working in the project.
No description

โœ… Is it possible to Parse a string and identify it's type?

I want to scan an index of an array and identify if it's an operator such as (+,-,*) or if it's an operand (doubles). Is this possible?