Resharper Colouring Variables In Red
Ok - I feel stupid but if I type a variable Resharper highlights the variable RED and then suggests split declaration and assignment
Now I want this suggestion but I do开发者_如何转开发 not want the variable to be red
Is there any way to remove this
I ve looked through all the options and still cannot figure this out
public static void Add<S, D>(List<S> source, List<D> destination)
where D : class
{
foreach (S sourceElement in source)
{
destination.Add(sourceElement);
}
}
EDIT: My problems seems to be the exact same thing as Resharper Suggestion Color Issue - I cannot download SP2 VS 2005.
Basically some variables are having red as BACKGROUND
Is there any other option I can use?
You should be able to set the severity in Menu -> Resharper -> Options -> Code Inspection -> Inspection severity.
No, the error comes from the fact that you try to assign D to S and there's no conversion possible
Add another constraint and solve error :
public static void Add<S, D>(List<S> source, List<D> destination)
where D : class
where S : D /*Solve the assignment issue */
{
foreach (S sourceElement in source) { destination.Add(sourceElement); }
}
精彩评论