One more small edit,
public static bool IsKindEqual(this SyntaxNode node, params SyntaxKind[] kinds);
Add method overloads,
public static bool IsKindEqual(this SyntaxNode node, SyntaxKind kind1); public static bool IsKindEqual(this SyntaxNode node, SyntaxKind kind1, SyntaxKind kind2); public static bool IsKindEqual(this SyntaxNode node, SyntaxKind kind1, SyntaxKind kind2, SyntaxKind kind3); public static bool IsKindEqual(this SyntaxNode node, SyntaxKind kind1, SyntaxKind kind2, SyntaxKind kind3, SyntaxKind kind4); public static bool IsKindEqual(this SyntaxNode node, params SyntaxKind[] kinds);
This will avoid creating and accessing array for less than 5 elements... as compiler will choose method and probably inline it as well.
Yep, you're right. :)
Developers of .NET libraries use this approach for some types. I also mentioned this approach in the article. :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
One more small edit,
Add method overloads,
This will avoid creating and accessing array for less than 5 elements... as compiler will choose method and probably inline it as well.
Yep, you're right. :)
Developers of .NET libraries use this approach for some types. I also mentioned this approach in the article. :)