-
Jan 13th, 2021, 03:34 PM
#1
Thread Starter
PowerPoster
IDE0059 Unnecessary assignment of a value...
So are you ever developing code and you want to know if your call to TableAdapter.Update() worked so you throw int rc = ta.Update() in front of it to check it when you run and then you leave it there because what if you come back to debug that code later? Am I supposed to either remove all these or remove the rule so I don't get the IDE0059 message? Or just look at them and let them be if I know they're okay/intentional?
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
-
Jan 13th, 2021, 03:40 PM
#2
Re: IDE0059 Unnecessary assignment of a value...
I would use a logging system like NLog and set the level of the error.
So you could do like
logger.Log(LogLevel.Trace, $"TableAdapter ran and returned: {rc}");
then in the logging config, for production you can set it to a minimum level of Warn. If you need to debug, you set the loglevel to Trace and run through the code again, and all of your more fine-grained logging would appear for you to review.
-
Jan 13th, 2021, 03:46 PM
#3
Thread Starter
PowerPoster
Re: IDE0059 Unnecessary assignment of a value...
I see...thank you. It's been a long day; I will digest this in the morning!
There are 10 kinds of people in this world. Those who understand binary, and those who don't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|