Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
GeneralRe: What is wrong with the structure of this code? Pin
Ron Nicholson24-Mar-15 11:43
professionalRon Nicholson24-Mar-15 11:43 
AnswerRe: What is wrong with the structure of this code? Pin
Gerry Schmitz24-Mar-15 12:14
mveGerry Schmitz24-Mar-15 12:14 
Questionc# Pin
Member 1133602722-Mar-15 8:40
Member 1133602722-Mar-15 8:40 
AnswerRe: c# Pin
Afzaal Ahmad Zeeshan22-Mar-15 8:53
professionalAfzaal Ahmad Zeeshan22-Mar-15 8:53 
Questionusing usage (IDisposable) Pin
TMattC22-Mar-15 6:15
TMattC22-Mar-15 6:15 
AnswerRe: using usage (IDisposable) Pin
phil.o22-Mar-15 6:38
professionalphil.o22-Mar-15 6:38 
AnswerRe: using usage (IDisposable) Pin
OriginalGriff22-Mar-15 6:41
mveOriginalGriff22-Mar-15 6:41 
AnswerRe: using usage (IDisposable) Pin
manchanx22-Mar-15 6:54
professionalmanchanx22-Mar-15 6:54 
Not as an answer to your question, phil.o and OriginalGriff already covered that - but since you're apparently interested to learn about good practice:

When simply returning false in case of an exception, you'll never know why exactly your code failed. You should either log the exception message (and possibly its stacktrace) to a logfile or reconsider if it's not even better to just let your exception "bubble up" - meaning, your method would simply be a void method: Continuation of program execution means all went well, otherwise the exception will also abort the execution of the calling code scope. This is in most cases the best approach and saves you from checking boolean success-return values "everywhere". Only catch an exception if you're going to do something with it: Logging and rethrowing it (potentially wrapped as an InnerException into a custom exception) or actually doing something to remedy the error so that the program can continue normally.
Recursion: see Recursion.

AnswerRe: using usage (IDisposable) Pin
jschell22-Mar-15 9:40
jschell22-Mar-15 9:40 
AnswerRe: using usage (IDisposable) Pin
TMattC22-Mar-15 9:49
TMattC22-Mar-15 9:49 
AnswerMessage Closed Pin
22-Mar-15 14:22
mveGerry Schmitz22-Mar-15 14:22 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 3:17
mveRichard Deeming23-Mar-15 3:17 
GeneralMessage Closed Pin
23-Mar-15 4:21
mveGerry Schmitz23-Mar-15 4:21 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 4:26
mveRichard Deeming23-Mar-15 4:26 
GeneralMessage Closed Pin
23-Mar-15 4:30
mveGerry Schmitz23-Mar-15 4:30 
GeneralRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 4:34
mveRichard Deeming23-Mar-15 4:34 
GeneralMessage Removed Pin
23-Mar-15 4:49
mveGerry Schmitz23-Mar-15 4:49 
SuggestionRe: using usage (IDisposable) Pin
Richard Deeming23-Mar-15 3:28
mveRichard Deeming23-Mar-15 3:28 
QuestionSQLite encryption types for data Pin
DPaul199422-Mar-15 6:03
DPaul199422-Mar-15 6:03 
SuggestionRe: SQLite encryption types for data Pin
Richard MacCutchan22-Mar-15 6:12
mveRichard MacCutchan22-Mar-15 6:12 
GeneralRe: SQLite encryption types for data Pin
manchanx22-Mar-15 6:42
professionalmanchanx22-Mar-15 6:42 
GeneralRe: SQLite encryption types for data Pin
DPaul199422-Mar-15 7:14
DPaul199422-Mar-15 7:14 
SuggestionRe: SQLite encryption types for data Pin
Richard Deeming23-Mar-15 3:31
mveRichard Deeming23-Mar-15 3:31 
QuestionHow to add the current items into combobox at runtime Pin
Member 1154531322-Mar-15 3:55
Member 1154531322-Mar-15 3:55 
AnswerRe: How to add the current items into combobox at runtime Pin
Dave Kreskowiak22-Mar-15 4:42
mveDave Kreskowiak22-Mar-15 4:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.