Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between c# using and Java import

I know that in java that we use *(asterisk) to import all the contents in a package like

import java.lang.*;

Then why don't we use same *(asterisk) in C# to import all the contents is there any method like in java to import all the contents. What is the difference between

import java.awt.*;

and

using System.windows.forms;
like image 891
Prabhavith Avatar asked Mar 19 '12 11:03

Prabhavith


People also ask

What is difference between C plus and plus C?

There is a major difference between C and C++. The C language is a procedural one that provides no support for objects and classes. On the other hand, the C++ language is a combination of object-oriented and procedural programming languages.

How is C++ better than C?

Compared to C, C++ has significantly more libraries and functions to use. If you're working with complex software, C++ is a better fit because you have more libraries to rely on. Thinking practically, having knowledge of C++ is often a requirement for a variety of programming roles.

What is difference in C language?

The original C programming language is not object-oriented, which is the most significant difference between the two. C is what's called a “procedural” programming language, while C++ is a hybrid language that's a combination of procedural and object-oriented. There are other key differences between C and C++.

Which is easier C or C++?

Answers: Actually, both are difficult and both are easy. C++ is built upon C and thus supports all features of C and also, it has object-oriented programming features. When it comes to learning, size-wise C is smaller with few concepts to learn while C++ is vast. Hence we can say C is easier than C++.


1 Answers

What the Java import does what .NET is called a reference - adding a reference to an assembly in .NET allows you to use the (public) types defined in that assembly.

The C# using directive is simply a way to access these types without typing out the whole namespace.

You can also use the directive to provide namespace aliases.

like image 144
Oded Avatar answered Oct 17 '22 16:10

Oded