30 lines
529 B
Plaintext
30 lines
529 B
Plaintext
=== Code examples
|
|
|
|
==== Noncompliant code example
|
|
|
|
[source,csharp,diff-id=1,diff-type=noncompliant]
|
|
----
|
|
bool StartsWithSlash(string s) =>
|
|
s.StartsWith("/");
|
|
----
|
|
|
|
[source,csharp,diff-id=2,diff-type=noncompliant]
|
|
----
|
|
bool EndsWithSlash(string s) =>
|
|
s.EndsWith("/");
|
|
----
|
|
|
|
==== Compliant solution
|
|
|
|
[source,csharp,diff-id=1,diff-type=compliant]
|
|
----
|
|
bool StartsWithSlash(string s) =>
|
|
s.StartsWith('/');
|
|
----
|
|
|
|
[source,csharp,diff-id=2,diff-type=compliant]
|
|
----
|
|
bool EndsWithSlash(string s) =>
|
|
s.EndsWith('/');
|
|
----
|