NekuSoul-Lemmy
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.dev to C Sharp@programming.devEnglish · 9 months ago

Simplify Exception Handling with Exception Filters

www.mathiashove.com

external-link
message-square
2
link
fedilink
7
external-link

Simplify Exception Handling with Exception Filters

www.mathiashove.com

💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.dev to C Sharp@programming.devEnglish · 9 months ago
message-square
2
link
fedilink
Exception filters make error handling in C# cleaner and more expressive. They let you catch only what you care about without cluttering your code with nested logic or rethrows.
alert-triangle
You must log in or # to comment.
  • Tamlyn@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    9 months ago

    So if i want to handle different status code, is several exception filters or if statements cleaner. I just remember a colleague has done that in the past with if statements.

    • 💡𝚂𝗆𝖺𝗋𝗍𝗆𝖺𝗇 𝙰𝗉𝗉𝗌📱@programming.devOP
      link
      fedilink
      English
      arrow-up
      3
      ·
      9 months ago

      Probably debatable. I think he was more addressing when you need to pull out a specific exception this is a cleaner way to do it. Saves having to rethrow the exception.

C Sharp@programming.dev

csharp@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !csharp@programming.dev

A community about the C# programming language

Getting started

  • C# @ Wikipedia
  • A Tour of the C# Language
  • Learn C#

Useful resources

  • C# documentation
  • C# Language Reference
  • C# Programming Guide
  • C# Coding Conventions
  • .NET Framework Reference Source Code

IDEs and code editors

  • Visual Studio (Windows/Mac)
  • Rider (Windows/Mac/Linux)
  • Visual Studio Code (Windows/Mac/Linux)

Tools

  • Decompilers: ILSpy, dotPeek
  • Scratchpad: LINQPad
  • Online playground and IL viewer: SharpLab

Rules

  • Rule 1: Follow Lemmy rules
  • Rule 2: Be excellent to each other, no hostility towards users for any reason
  • Rule 3: No spam of tools/companies/advertisements

Related communities

  • c/dotnet
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 10 users / day
  • 19 users / week
  • 9 users / month
  • 159 users / 6 months
  • 1 local subscriber
  • 1.8K subscribers
  • 269 Posts
  • 250 Comments
  • Modlog
  • mods:
  • Ategon@programming.dev
  • nibblebit@programming.dev
  • Spyros@programming.dev
  • BE: 0.19.15
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org