Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of :: in C#?

Tags:

syntax

c#

I have seen double colons (::) in generated code. I was wondering what its purpose is?

like image 770
AndyMM Avatar asked Jan 11 '10 21:01

AndyMM


People also ask

What does :: mean in C programming?

:: is the scope resolution operator - used to qualify names.

What does :: mean in C++?

In C++, scope resolution operator is ::. It is used for following purposes. 1) To access a global variable when there is a local variable with same name: // C++ program to show that we can access a global variable.

What is the main purpose of C language?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

What is the use of %* C in C?

When passed as part of a `scanf` format string, “%*c” means “read and ignore a character”. There has to be a character there for the conversion to succeed, but other than that, the character is ignored. A typical use-case would be reading up to some delimiter, then ignoring the delimiter.


1 Answers

It's the namespace alias qualifier operator. Citing from the linked-to MSDN page:

The namespace alias qualifier (::) is used to look up identifiers. It is always positioned between two identifiers, as in this example:

global::System.Console.WriteLine("Hello World"); 
like image 169
Mark Byers Avatar answered Oct 17 '22 23:10

Mark Byers