No, it’s not a bad practice. Putting return
where it makes sense improves readability and maintainability and makes your code simpler to understand. You shouldn’t care as finally
block will get executed if a return
statement is encountered.
More Related Contents:
- Try-Catch-Finally c# in Console [closed]
- Why is try {…} finally {…} good; try {…} catch{} bad?
- C# condition check using try catch [closed]
- C# catch a stack overflow exception
- Why catch and rethrow an exception in C#?
- How using try catch for exception handling is best practice
- Do try/catch blocks hurt performance when exceptions are not thrown?
- Does the C# “finally” block ALWAYS execute? [duplicate]
- Will code in a Finally statement fire if I return a value in a Try block?
- try/catch + using, right syntax
- Main method code entirely inside try/catch: Is it bad practice?
- What is the real overhead of try/catch in C#?
- What happens if a finally block throws an exception?
- Try-catch speeding up my code?
- When to use try/catch blocks?
- Wrong line number on stack trace
- Is it “bad” to use try-catch for flow control in .NET?
- C# Compiler should give warning but doesn’t?
- How to get the name of the method that caused the exception
- Deserialize JSON with C#
- Can I escape a double quote in a verbatim string literal?
- How to get the Display Name Attribute of an Enum member via MVC Razor code?
- Run async method regularly with specified interval
- How to find and replace text in a file
- How to read RegEx Captures in C#
- How can I use interface as a C# generic type constraint?
- Is it there any LRU implementation of IDictionary?
- Webclient / HttpWebRequest with Basic Authentication returns 404 not found for valid URL
- Order-preserving data structures in C#
- What does exclamation mark mean before invoking a method in C# 8.0? [duplicate]