namespace and use keyword [closed] - c#

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
why use of namespace and use keyword and declaration of namespace

Namespaces are used for organizing the types in the code in a logical manner. Imagine the Base Class Library itself, with its many thousands of types, without namespaces. It is simply a tool for making code more structured, much like the ability to create directories in the file system helps you organize your files.
Now, since the full name of a type is the namespace and type name, these may become fairly long. In order to make this easier on you as a developer, you can tell the compiler that you are using types from certain namespaces in a code file with using (or Imports in VB.NET) directives, and then you don't need to use the full name in that file. It simply tells the compiler where to go look for any type that is not entered using the full name in the code.

Related

Why can you make Primitive Datatypes in C#? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How come that in C# you can make Primitive Datatypes?
What kind of practical uses does this functionality have?
I assume you mean struct. There are various uses:
representing simple data such as a Point or ComplexValue that doesn't warrant the overhead of an object per instance : it is just a (preferably-immutable) set of values that are a composite
mapping fields to memory with explicit layout for interop purposes
avoiding GC issues for massive datasets
It is, however, very rare to declare a struct in C#; i.e. vanishingly rare. Nobody is making you do it, and if you don't like them : don't create any.
There is no such thing as 'primitive' datatypes if you're coming from Java world. All of those so called primitive data types are objects in System namespace (from MSDN).
You can, however, create user defined types.. and that is the whole concept of "class" and "enums" and "structs".
See here for understanding what "primitive" data types in C# actually mean:
primitive datatypes in C#

Why should we use xsd over c# classes [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
In our project, we are having xsd schema files, we are auto generating c# classes for xsd and using them. Each time, if we need to do modification, we are asked to do it in xsd file and which later generated into c# code.
My question is, why we need xsd in first place, why can't we directly have the serializable c# classes created.
I'm assuming the changes to the classes are a result of changes to some XML data structure that the app supports. With that assumption, here are a couple of reasons to keep the XSDs in sync:
If you ever re-generated the class files from the XSDs all changes to the classes would be lost
The XSDs could be used to validate any XML document that could be (de)serialized using those classes.

C# / .NET built-in interfaces list [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm looking for full C# standard interfaces list. I'm almost sure that such topic was posted somewhere on MSDN, but I can't find it. Does anyone has a reference?
im sorry but such doc does not exist...
See, msdn documentation is organized by "namespaces", so... you can see that such document would not fit anywhere... by the way, why would you want that?!? if you compile the documents of each interface in the basics dll (system, text, system.data, linq, etc...) you would have a quite large document that would cause more confusion than "de-confusion", since in diferent namespaces interfaces may have the same name...

What does "System.IO" mean in C#? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'm in my first year studying .Net and came to the chapter, "An Introduction to the System.IO classes"
I'm just curious to know what the .IO stands for. I do understand that this is learning about how to use Directories, Files and paths.
IO itself stands for Input/Output.
This is the entire System.IO namespace: http://msdn.microsoft.com/en-us/library/system.io.aspx
You're probably going to cover directories, files, and streams.
'IO' is the standard acronym for Input/Output. The System.IO namespace contains all the classes that deal with input/outputs like reading/writing files.
IO stands for Input and Output. Basically System.IO contains methods for reading and writing files as well as using Streams like you have said already.

Cannot make C# constructor compile [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Whenever i try to apply my own constructor instead of the default one in VS 2010 I get the compiler error:
Error 1 The namespace 'global namespace' already contains a definition for 'whatever'
Just as an example the compiler will not let me do this:
public class whatever
{
public whatever()
{
}
};
[Comments helped the OP solve the problem. Solution is here.]
The class is declared again in the same namespace in another file in your solution. Make sure that any such classes are renamed or removed, and everything should compile just fine.
In C# the class declaration and the definition are not separated (unlike C++) so you don't need a semi-colon after your class declaration.
edit
That error has nothing to do with the sem-colon, it was just something that jumped out at me. I would have to assume that your class was defined somewhere else in the same namespace. Is "whatever" really the name of the class you are trying to create?

Categories