breadbyte / ConsoleInteractive

a user input library for c#
Apache License 2.0
6 stars 3 forks source link

Fix all warnings & Trim #18

Closed BruceChenQAQ closed 1 year ago

BruceChenQAQ commented 2 years ago

Part of the modification in https://github.com/MCCTeam/Minecraft-Console-Client/pull/2226.

breadbyte commented 2 years ago

Everything looks good to me, but are the Match casts really necessary?

A MatchCollection is already a type of IEnumerable<Match>, so iterating over it returns a Match object. I don't see the need to re-cast it, as it is redundant.

BruceChenQAQ commented 2 years ago

The cast here is really redundant, I changed it because VS will prompt IDE0220 here.

(same question) IDE0220 on foreach (Match m in regex.Matches) – Should Not Occur

BruceChenQAQ commented 2 years ago

Remove it in https://github.com/breadbyte/ConsoleInteractive/pull/18/commits/f3cb035eec823bef0ab61ac0dc78df3958efd808 and change that regular expression to be precompiled.

breadbyte commented 1 year ago

Looks good to me. Thanks for the contribution!