Results 1 to 3 of 3

Thread: IDE0059 Unnecessary assignment of a value...

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,475

    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.

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    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.

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,475

    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
  •  



Click Here to Expand Forum to Full Width