C Sharp

1532 readers
2 users here now

A community about the C# programming language

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

founded 1 year ago
MODERATORS
1
2
4
What's new in C# 13 (www.youtube.com)
submitted 6 days ago by SmartmanApps to c/csharp
3
5
What's new in C# 13 (learn.microsoft.com)
submitted 1 week ago by SmartmanApps to c/csharp
4
5
submitted 3 weeks ago by Mihies to c/csharp
 
 

Well written thoughts on C#12 primary constructors. Sadly they are not really useful. At least for now.

5
 
 

This should be a huge boon for introducing people to C# development on Mac and Linux!

Take note though, that the free version comes with mandatory collection of anonymized usage data. As far as I'm aware this cannot be deactivated.

6
4
submitted 1 month ago* (last edited 4 weeks ago) by CodiUnicorn to c/csharp
7
8
9
10
2
submitted 1 month ago* (last edited 1 month ago) by [email protected] to c/csharp
 
 
11
 
 

Would love a channel like Codebullet, but more focused with C# shenanigans that isn't necessarily educational

All the C# channels I've seen have been mostly good or informative, but not exactly something I want to put on at night like I would a Codebullet video to have a good laugh

Does anyone know of any good channels like that?

12
 
 

This may be common knowledge but I've never seen it online.

[MaybeNull] public Entity Entity { get; set; }

You now get a warning when accessing without a check and when setting to null.

Sadly you still need to ! in quries

13
5
submitted 2 months ago by SmartmanApps to c/csharp
14
15
4
.NET Digest #3 (pvs-studio.com)
submitted 2 months ago* (last edited 2 months ago) by AlexKochetkova to c/csharp
16
17
18
16
submitted 3 months ago* (last edited 3 months ago) by DrDeadCrash to c/csharp
 
 

A collection of tools for dealing with nulls, failures and the generic type issues that arise in this domain.

https://github.com/Andy3432344/SafeResults

I'm the author, let me know what you think!

*Edit: updated to show GitHub link, sorry!

19
31
Only Anders can C# (programming.dev)
submitted 3 months ago by SmartmanApps to c/csharp
 
 
20
 
 

From the meeting minutes:

First up today, the discriminated unions working group presented the proposal they've been working on for a while to the broader LDM. This was a broad overview session, rather than a deep dive into nitty-gritty questions; there are still plenty of little details that will need to be filled in, but we're cautiously optimistic about this proposal and moving forward with it. There was some concern about some of the ternary behavior, but we can dig more into that as we bring this proposal back for detailed follow ups in the future.

21
 
 

Let's say I have a method that I want to make generic, and so far it had a big switch case of types.

For an simplified example,

switch (field.GetType()) {
case Type.Int: Method((int)x)...
case Type.NullInt: Method((int?)x)...
case Type.Long: Method((long)x)...

I'd like to be able to just call my GenericMethod(field) instead and I'm wondering if this is possible and how would I go around doing it.

GenericMethod(field)

public void GenericMethod<T>(T field)

Can I use reflection to get a type and the pass it into the generic method somehow, is it possible to transform Type into ?

Can I have a method on the field object that will somehow give me a type for use in my generic method?

Sorry for a confusing question, I'm not really sure how to phrase it correctly, but basically I want to get rid of switch cases and lots of manual coding when all I need is just the type (but that type can't be passed as generic from parent class)

22
23
24
25
view more: next ›