r/csharp • • 13h ago

About codebase conventions, who is actually right and who is wrong here?

Post image
80 Upvotes

Let's say you're a Technical Founder like Mark Zuckerberg or Bill Gates. You have a CS degree worked as mid level developer.

You've written some code (as show in the pic) and added comments to remind yourself and other developers what the code does, so nobody forgets in the future.

Now, you have a Senior Developer on your team who worships Uncle Bob's Clean Code principles like a cult!

she reviews your PR and reject it, saying

"Good code should be self-explanatory. The code itself should explain what it's doing.

Anyone should be able to look at it on the first time and understand it right away.

So go back and remove those comments. They're not clean! God damn it!"

--

What would you do in this situation?

Would you trust the senior dev and delete the comments because they have more experience than you, even though you're the founder and have less development experience than they do?

Ps. We have to move fast


r/csharp • • 11h ago

Discussion Can I learn computer architecture and operating systems with C#?

13 Upvotes

I'm a full-stack developer, and I want to learn more about computer architecture and operating systems to become a better developer and understand what's happening under the hood.Can I learn these things with C#, or should I learn C first? Does the language even matter that much?What would you recommend?


r/csharp • • 14h ago

Help Anyone here built measurement/monitoring software in C#?

10 Upvotes

Hey, has anyone here worked on industrial measurement or monitoring software with C#?

I'm currently looking into rebuilding an older monitoring solution from scratch and still figuring out the right architecture.

We're talking different measurement devices, continuous data streams (up to 1k samples/sec per channel), older Windows PCs with 4 GB RAM, and ideally something that can run reliably for months.

What I'm a bit unsure about is the data integrity side of things, especially crash recovery, audit trails, and GMP requirements.

I'm leaning towards C#, probably with SQLite, but not sure if I'm overlooking something.

Would be really interested to hear from anyone who's built something similar. What would you do differently today?


r/csharp • • 1h ago

Help What’s the best way to learn c#?

• Upvotes

I don’t know how to do anything with c# but I won’t to learn what’s the best way? Is it YouTube, online classes, learn to code websites or something else


r/csharp • • 4h ago

ResXLocalization 2.0: .resx files based localization for Avalonia and WPF, now with ICU MessageFormat support

1 Upvotes

Hi, I have just released version 2.0.0 of ResXLocalization, my localization library for WPF and Avalonia (MIT-licensed).

In essence:

  1. Create your .resx files.

  2. Install ResXLocalization.Avalonia or ResXLocalization.WPF.

  3. Let it generate the typed resource keys (source generator) and use them in XAML and code:

    <TextBlock Text="{l:Localize {x:Static res:SettingsViewKeys.SaveSetting}}" />

    this.SaveButton.Content = Localizer.Current.Get(SettingsViewKeys.SaveSetting);

  4. And live switch the language/culture:

    Localizer.Current.CurrentCulture = new CultureInfo("de-DE");

Typed keys mean you can reference resources like objects and get compile time checking.
This avoids having typos in resource names go unnoticed.

When you change Localizer.Current.CurrentCulture it updates all localization bindings in place. If you assign a string directly in code as above, you need to call Get again after changing the culture.

The biggest new feature of V2 is the optional ICU MessageFormat support (thank you livonium for the feature request that sparked the work on V2!):
For something like “1 file deleted” / “5 files deleted”, you can use a plural rule in your resource text:

{Count, plural, one {# file deleted} other {# files deleted}}

(You need to install the NuGet package ResXLocalization.MessageFormat and call Localizer.Current.UseMessageFormat() at startup for this to work)

Then just bind the count like this:

<TextBlock>
  <TextBlock.Text>
    <l:Localize Key="{x:Static res:AppStringsKeys.FilesDeleted}">
      <l:Argument Name="Count" Value="{Binding DeletedCount}" />
    </l:Localize>
  </TextBlock.Text>
</TextBlock>

The text block is automatically updated when either the count or the language changes.
Of course you can also bind multiple values to a localized text/message.

Each translation can use its language/culture plural rules.
The ICU message format support is opt-in. If you don't use it, the default formatter (based on string.Format) is used.

A few other changes in this release:

  • Typed keys now finally work also without a .Designer.cs file.
  • Formatting arguments are now placed via <Argument> children of the Localize/LocalizeEnum markup extension, which replaces the old Arg0…Arg8 attached properties, so arguments now also work in styles and templates.
  • Resource keys are bindable, so the view model can dynamically decide which resource to use.
  • You can change the preview language (for VS XAML Designer/Rider XAML previewer) with DesignTime.Culture. However, ResXLocalization does not work correctly in Rider's WPF previewer due to a number (there are quite a few) of bugs in it. JetBrains has really made quite a few unfortunate design decisions for their previewer. I tried to work around them as far as possible, but it's nowhere near perfect.

The library supports .NET 8 and later with Avalonia (12+) or WPF.
For Avalonia it is completely native AOT compatible and trim safe (for WPF, native AOT is not supported, because WPF doesn't have support for it).

If you are upgrading from V1, please read the migration guide, because there are quite a few breaking changes to make it all work.

The repository has runnable sample apps (both for Avalonia and WPF):
https://github.com/rent-a-developer/ResXLocalization

AI attribution:
I used AI, mainly Claude, for brainstorming, planning, experiments, and parts of the implementation. It helped me save a great deal of time finding good solutions for a couple of quirks of Avalonia and (especially) WPF and the source generator’s MSBuild integration. I reviewed the generated code and I use ResXLocalization in my own projects, so I would not settle for some half-baked vibe coded garbage. Of course, if you don't like projects where AI is involved, then just ignore this project and that's fine too.

I hope this helps someone with the localization of their app(s)!

If you find this library useful I would appreciate a star on GitHub.

Of course feature request and (reasonable) criticism is welcome too.


r/csharp • • 6h ago

[Open Source] Created a simple tool to fix broken Windows Update policies and reliably install .NET Framework 3.5 (dev on .NET 4.7.2)

Thumbnail
1 Upvotes

r/csharp • • 4h ago

I built a small Windows file encryptor in C# / WinForms with my own cipher. It's unaudited, looking for feedback

0 Upvotes

Snowy is a Windows desktop app for encrypting local files. It has three levels: Simple (obfuscation only), Moderate (password with Argon2id) and Protected (a graphical pattern or a question).

The cipher is Snow-II, my own construction: 256-bit block, 18 rounds, built on the AES S-box and the Rijndael-256 round structure, with a different hash-based key schedule. Please don't treat it as secure. It hasn't been reviewed by anyone outside the project, and the README says so at the top.

What might interest C# people:

  • Custom WinForms UI with animations, themes and a vsync-driven frame clock.
  • Vault format with encrypt-then-MAC over the whole header, verified in constant time before anything is decrypted or written.
  • Argon2id via Konscious, with KDF parameters stored in the header and bounded before use.
  • Table-driven cipher with parallel CTR for large files; a naive reference implementation and frozen test vectors, reproduced by an independent Python file.
  • 61 unit tests in xUnit, run in CI on Windows.

Repo: https://github.com/chara123666/snowy

The most useful feedback would be on the design, especially the open questions in docs/SPEC.md section 7. If you see a real break, please report it privately as described in SECURITY.md.


r/csharp • • 12h ago

Help Is C# worth learning in the AI era? (Web dev background looking to future-proof)

0 Upvotes

Hey everyone,

I’ve been building things for the web using JavaScript, TypeScript, and PHP (Mostly). Up to now, it’s been a solid stack with a great job market. But with how fast things are shifting, especially with AI tooling changing the landscape. I’m trying to future-proof my skills and can't entirely predict where things are heading.

I keep hearing about C# and .NET as a robust enterprise choice, but I’m wondering how it fits into the current AI-driven era.

  • For those of you working in C#/.NET right now, how has the job market and day-to-day work changed with AI code assistants?
  • Is learning C# a smart pivot or addition for a web dev trying to stay relevant, or should I double down elsewhere?

Curious to hear your thoughts and experiences!