Code Inspection: Assignment is not used
By analyzing the control flow of your code ReSharper is able to detect redundant initializers of fields and local variables. If the value you assign is not used until the next assignment is made in any of the execution paths, ReSharper suggests to remove the redundant initializer.
Redundant assignments can occur in different situations.
For example, when a variable is initialized with the default value, or, like shown below,
when some non-default value is assigned, but never gets used.
Here you can see that
myDoc is initialized with a new instance of
XDocument, but the next line assigns it to either
so the initially created object is nothing but a new task for the garbage collector.
Here is an example of a quick-fix suggested by this inspection: