dotnet / dotnet/dotnet-api-docs

if ((stringValue.IndexOf("pink") > -1)) is inefficient

Open
#10,880 2 comments 0 reactions 0 assignees View on GitHub
area-WinForms untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

### Type of issue

Typo

### Description

The code example shouldn't read:
if ((stringValue.IndexOf("pink") **>** -1))

This is more efficient:
if ((stringValue.IndexOf("pink") **!=** -1))

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.datagridview.cellformatting?view=windowsdesktop-9.0&redirectedfrom=MSDN

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Windows.Forms/DataGridView.xml

### Document Version Independent Id

d789c17f-da81-5aca-c7f2-63c547287417

### Article author

@dotnet-bot

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.