How a string is accessible without using a system namespace

Someone may say that I am not using the system namespace, but the string is available as a string hello = "Hello"; and does not produce any compile-time error

but if I write the string in uppercase, it is not available.

sealed class SealedClass
{
    public void PrintSealed()
    {
        string hello = "Hello";
    }
}
+4
source share
1 answer

To use a "piece" of the library you do not need a keyword using. The keyword is usingintended only to facilitate reference to types within namespaces.

When you write

using System;

.... ...

String hello = "Hello";

the compiler replaces it

System.String hello = "Hello";

But you could write directly

System.String hello = "Hello";

without using System. But this is pain :-)

string System.String, , string, # System.String (MSDN).

, , , , Add Reference. mscorlib () ( )

Microsoft Visual C/++, - :

#pragma comment(lib, "somelibrary")

.lib (). Visual C/++ , , , .

+9
source

All Articles