Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
67 views

I'm checking the file signature of an IFormFile and I'm curious if I can avoid resetting to the beginning of the stream after my check is done. I intend to dispose the copy of the original stream and ...
BobDidley's user avatar
  • 211
1 vote
2 answers
117 views

I have a class that looks like this: public int DoWork(int value) { return value + GetDataFromDB(); } public int GetDataFromDB() { return 10; } In the real world the second function goes ...
John's user avatar
  • 306
1733 votes
30 answers
542k views

What is the difference between const and readonly in C#? When would you use one over the other?
readonly's user avatar
  • 358k
4 votes
2 answers
101 views

I have an .sln referencing a single .csproj. Inside the .csproj I download static dependencies into ASP.NET's wwwroot: <Target Name="DownloadContentFiles" BeforeTargets="Restore&...
Benni's user avatar
  • 1,102
2440 votes
15 answers
293k views

I have been running StyleCop over some C# code, and it keeps reporting that my using directives should be inside the namespace. Is there a technical reason for putting the using directives inside ...
benPearce's user avatar
  • 38.5k
9 votes
2 answers
2k views

All I can find from Microsoft is two blog posts: "Introducing support for SLNX, a new, simpler solution file format in the .NET CLI" dated March 13th, 2025, says that it is a preview ...
Mike Nakis's user avatar
1 vote
0 answers
98 views

As the title says, I have this class which is based on PdfSharpCore. I have a PDF file which is AcroForm (doesn't seem to be XFA, although I'm not 100% as I don't have much experience with PDFs - but ...
Octavian Niculescu's user avatar
1204 votes
30 answers
1.2m views

Is there a way to deserialize JSON content into a C# dynamic type? It would be nice to skip creating a bunch of classes in order to use the DataContractJsonSerializer.
jswanson's user avatar
  • 16.5k
1288 votes
15 answers
2.3m views

I have classes like these: class MyDate { int year, month, day; } class Lad { string firstName; string lastName; MyDate dateOfBirth; } And I would like to turn a Lad object into a ...
Hui's user avatar
  • 14.6k
1145 votes
28 answers
1.3m views

How do I find the application's path in a console application? In Windows Forms, I can use Application.StartupPath to find the current path, but this doesn't seem to be available in a console ...
JSmyth's user avatar
  • 12.2k
2 votes
3 answers
2k views

On Play Console in App bundle detail I get this: Does not support 16 KB Hide detail Learn more Libraries that do not support 16 KB: base/lib/arm64-v8a/libHarfBuzzSharp.so base/lib/arm64-v8a/...
zilon co's user avatar
3 votes
0 answers
145 views

I'm trying to build a background service with autostart in the background. Core logic in console app executing from OnStart, however after several failures at debugging root cause - modified code by ...
userXeroWan's user avatar
220 votes
9 answers
193k views

Is there anyway to open and work on .net framework 4.5 project in visual studio 2022. May be problem is not with VS2022 but as .net framework 4.5 developer pack is not available any more .. my project ...
Moumit's user avatar
  • 9,860
0 votes
1 answer
102 views

I have an exe which is written using .NET Framework 4.8. I have the following line in the vbproj file of the exe. <ItemGroup> <BootstrapperPackage Include=".NETFramework,Version=v4.8&...
Jyothish Bhaskaran's user avatar
1 vote
2 answers
254 views

I am trying to dynamically generate a C# class T at runtime using Reflection.Emit (or other dynamic type creation techniques). The challenge is that the base class is a generic type U<T> that is ...
Piyo's user avatar
  • 45
145 votes
11 answers
109k views

I can't access dotnet after an update. Reinstalling dotnet and vscode didn't help. On Ubuntu 22.04, running dotnet --info produces the output: A fatal error occurred. The folder [/usr/share/dotnet/...
Vladislav Volynets's user avatar
734 votes
47 answers
569k views

All of a sudden I keep getting a MetadataException on instantiating my generated ObjectContext class. The connection string in App.Config looks correct - hasn't changed since last it worked - and I've ...
J. Steen's user avatar
  • 15.6k
0 votes
0 answers
71 views

I'm using data annotations from System.ComponentModel.DataAnnotations in my ASP.NET project. I get an error message where you can describe the requirements such as "Name is required" and etc....
DELI's user avatar
  • 11
770 votes
36 answers
399k views

Microsoft should have implemented something snappy for INotifyPropertyChanged, like in the automatic properties, just specify {get; set; notify;} I think it makes a lot of sense to do it. Or are there ...
657 votes
43 answers
845k views

I know the following is not possible because the Enumeration's type has to be an int enum GroupTypes { TheGroup = "OEM", TheOtherGroup = "CMB" } From my database I get a field with ...
Boris Callens's user avatar
0 votes
1 answer
129 views

I have an C# .NET app that I tried packaging both as appxbundle and msix to use as a Kiosk application. Both works when launched normally but fails to load when run after setting up assigned access. I ...
Adhil Chalil's user avatar
884 votes
32 answers
922k views

Using C#, how can I delete all files and folders from a directory, but still keep the root directory?
JL.'s user avatar
  • 81.7k
1 vote
0 answers
170 views

I am creating a brand new project to prototype an ASP.NET Core 9 Web API backend with PostgreSQL using the latest Entity Framework Core 9 and Npsgsql 9. Everything was going well until I hit a table ...
Trant's user avatar
  • 3,651
3 votes
0 answers
92 views

Current problem: when we store files in Azure Blob Storage, we create a folder per entity (company/user). The name of the folder includes: Entity ID (required to guarantee that the folder name will ...
Oleksandr Karpiuk's user avatar
0 votes
1 answer
67 views

This is my .NET Http Client minimal reproducible example, which connects to a server running on a CNC machine edge device and uploads a local JSON configuration file: using System; using System.IO; ...
PatJon6's user avatar
  • 33