❔ Catching Exceptions with generic parameters?
When adding an entity to the database, i first check if it already exists and if it does I throw an error. Now since I have alot of entities I was thinking of make an exception class that takes in a generic (the class type).
Unfortunately this doesn't work because I won't be able to catch it in my controller since I don't specify the generic.
G
GameShark•399d ago
G
GameShark•399d ago
I guess i could do this, but it feels weird doing reflection for the arguments from wherever the exception gets thrown
G
GameShark•399d ago
Thanks!
A
Accord•390d ago
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.
Was this issue resolved? If so, run /close
- otherwise I will mark this as stale and this post will be archived until there is new activity.We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
52KMembers
View on DiscordWant results from more Discord servers?
More Posts❔ How should I learn programming?I'm sure this is a common question, but I want to learn game development but am a pretty new C# prog❔ How to properly structure projects in a multi-app MVVM solution?I tend to structure my MVVM projects in the following way:
```
.
├── src/
│ ├── Applications/
│ Sending File and Data to a Minimal API endpointHi. I am using .NET 7, Minimal API and Mailkit.
What I want to do is to send an attachment along wi❔ reprotucing the kings pathcan anybody help me fix this code
https://paste.mod.gg/sgsvrbaqnmpi/0
```
the input is
number of obs❔ Its there a way to fix this?Hi there, currently I am trying to develop some functions to publish them to azure later, but right ✅ Does this styling code look right?I'm using this code for a simple hover effect. Im wondering if I'm doing this correctly:
<Window.Re❔ ?[] operator for dictionariesIs not working. It is explained here. https://learn.microsoft.com/en-us/dotnet/csharp/language-refer❔ IAsyncEnumerable vs List<T> as parameter in methodI have a method that is overloaded and will take in a List<T> or IAsyncEnumerable. The method will b❔ This code is bugged how can i solve it?```LogiwaEntities1 db = new LogiwaEntities1();
ProductData productData = new ProductData✅ How to add hover effect to WPF button elementThis code I'm using isn't working. When I hover over buttons its a lightblue color.
<Style with or without refso i learned that in c#(or most oop languages) when you create a method that takes an object as a pa✅ .net trying to find non-existent cs files`Error IDE1100 Error reading content of source file 'D:\Dev\C++\Test\TestCS\obj\Debug\net6.0\.