Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

51 lines
1.4 KiB
Plaintext

== Why is this an issue?
The ability to target the common language runtime from several languages means that clashes are possible when a word that is reserved in one language is used as the name of a namespace, type or member in another.
This rule raises an issue when a keyword from {cpp}/CLI, C# or Visual Basic is used as an identifier.
=== Noncompliant code example
[source,csharp]
----
public string nameof(string s) { return s; } // Noncompliant
...
public string Hello { get { return "World!"; } }
...
Console.WriteLine(nameof(Hello)); // prints "World!" instead of "Hello" as expected
----
=== Compliant solution
[source,csharp]
----
public string GetValue(string s) { return s; }
...
public string Hello { get { return "World!"; } }
...
Console.WriteLine(GetValue(Hello));
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
=== on 1 Mar 2017, 15:50:46 Valeri Hristov wrote:
It seems that not all C#/VB/{cpp} keywords are reported by this rule and there is no list of the keywords FxCop matches.
We are postponing the development of this rule because of its small target audience (it is best suited for library developers, who's products will be used in different languages).
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]