Last active
March 23, 2021 21:40
-
-
Save haacked/fcd8c18bef2e257d2c4a2dd31b9784cb to your computer and use it in GitHub Desktop.
Weird roslyn waring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IArgument | |
{ | |
/// <summary> | |
/// The value of the argument sans quotes. | |
/// </summary> | |
string Value { get; } | |
} | |
public interface IArguments : IReadOnlyList<IArgument>, IArgument | |
{ | |
void Deconstruct(out IArgument first, out IArgument second, out IArgument third); | |
} | |
var (verb, mention, description) = messageContext.Arguments; // messageContext.Arguments implements IArguments | |
// Error CA1508 : 'mention.Value is "not"' is always 'false'. Remove or refactor the condition(s) to avoid dead code. | |
if (verb.Value is "is" && mention.Value is "not") | |
{ | |
} | |
// However, this works fine: | |
if (verb is {Value: "is"} && mention is {Value: "not" }) | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have these set in the .csproj