C#

C

C#

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

Join

✅ Send automated email.

Hi everyone. I just finished a web scraper assignment that I got from school. I want to build on it and implement a system that lets me take the text that the web scraper generates and send it once a day as an email. What is the best way to do it?

ListBox entries from UserControl not working.

```csharp public static class Logger { public static string WriteLog(string message) {...

✅ null or 0

if you declare a variable without giving it a value, is the value null or 0?

Selection box at the git hub's readme.md

In Visual Studio, a selection box is created using the left mouse button and alt key, which allows developers to flexibly select multiple lines, do you know how to do it on GitHub README.md ?
No description

Any custom TLS client that has minor implementation of HTTP with custom cipher suite support?

As we all know, C# is one of the languages that cannot change cipher suites in the http client. I know they added support for it a while back, but it only works on linux. Don't know why they've yet to add a full implementation for it that supports windows. A few years back, I found a library that utilized BouncyCastle.Crypto and had a partial implementation of HTTP. Enough to do basic POST and GET requests with custom cipher suite ordering. Unfortunately, I don't remember the library and was just wondering if anyone knows of any libraries that offer such functionality?...

JWT, ClaimIdentity and ClaimPrincipal

Hi everyone, I have a service that creates a JWT using the JsonWebTokenHandler. When I create my claims, I am using ``` var claims = new List<Claim> {...

Garbage Management wpf

Hi, I'd like to know how to manage process memory in my software. Here is some code that has a constructor with a modalNavigationStore parameter, which is a singleton that I never dispose of. I'd like to know if I need to set _modalNavigationStore = null to ensure proper disposal and garbage collection when i'm done with my service ? ```JAVA public class Service { #region Fields...

Console auto closes instantly when i run the program

I made a geolocater, and once i type in the IP, it breifly shows all the info but then the console IMMEDIATEly closes and the program ends. how do i fig this?

Box plot drawing to sheet in c# (about 500 lines)

The code should show the min and max values of Chart (Box Plot) calculated, but that is not the case. It's really urgent, so please solve it.

reading a txt file and saving the paragraph as one variable

hi so ive got a txt file that looks smth like this BOOK|The Fellowship of the Ring|1954|J.R.R. Tolkien Fnheba, gur Qnex Ybeq, unf tngurerq gb uvz nyy gur Evatf bs Cbjre rkprcg bar - gur Bar Evat gung ehyrf gurz nyy - juvpu unf snyyra vagb gur unaqf bs gur uboovg Ovyob Onttvaf. Lbhat Sebqb Onttvaf svaqf uvzfrys snprq jvgu na vzzrafr gnfx jura Ovyob ragehfgf gur Evat gb uvf pner. Sebqb zhfg znxr n crevybhf wbhearl npebff Zvqqyr-rnegu gb gur Penpxf bs Qbbz, gurer gb qrfgebl gur Evat naq sbvy gur Qnex Ybeq va uvf rivy checbfr. ----- SONG|Fly Me to the Moon|1964|It Might as Well be Swing|Frank Sinatra...

✅ asp.net web forms

not sure why keep getting this error, did it the first time and it worked now i keep getting this error , can someone help me understand what might be the case? , When i use anynumber with decimal point for that line it works , but when its grabbing the decimal from the gridview i think i has a comma
No description

✅ static, public, void

I'm new to C# and I was wondering if I were correct that static means you can use an object or method outside of the file you are coding in, public means you are able to use an object or a method outside of a specific class and void means you will not return anything in the method proceeded?

Conflicting System dlls

I have project that has DisableImplicitFrameworkReferences and NoStandardLib enabled and references custom mscorlib and System.* dlls. However, when I add a package like this: ```xml <PackageReference Include="MonoMod" Version="22.7.31.1"> <IncludeAssets>all</IncludeAssets>...

Help!!!

Hey, I'm looking for someone who can briefly structure my code into different classes for me. I am still relatively new to CSharp and currently only get errors. Would be nice if someone would contact me via DM. 🙂

Reflection Load Interface Instance

so i am loading plugins from multiple assemblies and i look for types Implementing the IPlugin interface. I then create an instance of that class (i tried both using activator and manual constuctor call) and when a look at the GetType from the instance i get back, i see the IPlugin and IDisposalbe interfaces listed as implemented on the Type Info, but when i try to cast/use the interface methods i simply get an exception or null (System.InvalidCastException: Unable to cast object of type 'TestPl...

I require some help understanding MVC and Database loading/updating

Hi, I'm very new to MVC and new to ASP.NET CORE, So these questions may be all over the place. I do have an understanding of C# & Object-Oriented programming. I'm trying to make a web application that has two tables, a Users table and a UserPhoneNumbers table, for this app I am allowing a single User to have Multiple UserPhoneNumber attached to it. I understand that I'll need a Model for each. Here are my two example models...

✅ static r public?

I was writing code something like this, class Physics { public int Force; }...
No description

How to get documents for specific user by Cloud Firestore?

I am developing a .NET MAUI application where users can register and sign in. After logging in, they can perform CRUD operations on documents. Each document saved to Cloud Firestore includes a user_id or owner_id property to indicate the owner. What is the best way to filter documents so that I only retrieve those associated with a specific user? Currently, I am using: CollectionReference documentsRef = db.Collection("documents"); and then querying for documents where UserId equals the currentUserId....

✅ How do I get to the graphical window (where I can drag and drop tools)

I'm studying some graphics now with WPF. I've added a button and label, but after I was running the program, the graphical window disappeared , how do I get it back? Thank you!...
No description