Skip to content

TryMethod Implementation#358

Closed
AdamSpeight2008 wants to merge 4 commits intodotnet:masterfrom
AdamSpeight2008:AdamSpeight2008_a
Closed

TryMethod Implementation#358
AdamSpeight2008 wants to merge 4 commits intodotnet:masterfrom
AdamSpeight2008:AdamSpeight2008_a

Conversation

@AdamSpeight2008
Copy link
Contributor

It is a common pattern to have CanGetChar() to be closely followed by a call to

  • PeekChar
  • GetChar
  • PeekAheadChar
    So I think could be beneficial to have Try variants of them.
  • TryPeekChar
  • TryGetChar
  • TryPeekAheadChar

This will allow us to "cache" the character and avoid subsequent additional calls to those methods.

It also allows to inline some If Statements into their enclosing While condition.

- TryGetChar
- TryPeekChar
- TryPeakCharAt
Renamed a local 2Here" to "offset"
@gafter
Copy link
Member

gafter commented Feb 17, 2015

@AdamSpeight2008 This pull request failed the automatic merge and build and test. Please merge the latest sources and try again.

@gafter gafter self-assigned this Feb 17, 2015
@gafter gafter closed this Feb 17, 2015
@AdamSpeight2008 AdamSpeight2008 deleted the AdamSpeight2008_a branch March 6, 2015 16:03
@AdamSpeight2008 AdamSpeight2008 restored the AdamSpeight2008_a branch March 6, 2015 16:03
@AdamSpeight2008 AdamSpeight2008 deleted the AdamSpeight2008_a branch October 31, 2015 22:30
@gafter gafter added the Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on. label Dec 9, 2015
dibarbet pushed a commit to dibarbet/roslyn that referenced this pull request Nov 21, 2025
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants