Introduction (C#) Flashcards
What is .Net?
It is a runtime similar to Java that executes Microsoft intermediate language (MSIL) at runtime.
What are the three file types in a .Net project?
- Solution files (.sln).
- CS project files (.csproj).
- Code files (.cs).
What does solution files contain?
They contain a set of project files in a .Net project.
What are CS project files and what do they contain?
- They are the smallest buildable unit in a .Net project and they are build into a DLL or executable file (EXE file).
- They can contain dependencies to other projects and build information (ant/make style).
What do CS project files contain?
They contain C# code and belong to a C# project (.csproj).
What is the style convention for methods in a .Net project?
Methods are always capitalized and uses the PascalCase.
What is the style convention for variables in a .Net project?
Variables use camelCase.
What are namespaces?
They are used to organize and group related classes and other types of code.
It is like a container that holds a collection of related classes, structures, and other types.
Does package-scoped classes and methods exist in a .Net project?
No.
What is the difference between a namespace and a package in a .Net project?
Namespaces are like a container that holds a collection of related classes, structures, and other types. It helps to organize code and avoid naming conflicts.
On the other hand, a package in Java is a collection of related classes and interfaces that are used to organize code and to provide a level of access protection and name-spacing.
What does it mean when a public sealed class in a .Net project?
The keyword “sealed” is used to indicate that a class cannot be inherited or subclassed, similar to the “final” keyword in Java.
A public sealed class cannot be extended by other classes, and any attempts to do so will result in a compilation error.
What does it mean when a final class is “sealed” and a final variable is “readOnly” in a .NET project?
- Once a class is “sealed”, it cannot be inherited by any other class. This means that no further functionality can be added to the class by extending it.
- Once a readonly variable is initialized, its value cannot be changed. This is useful for values that should not change during runtime, such as configuration settings or constants.
What does the keyword “internal” mean?
It means that any class, method, or variable marked as internal can be accessed within the entire project, but not from outside the project or from other assemblies.
What are override methods annotated as?
They are annotated as abstract, virtual or override.
What are the differences in type names between Java and C#?
boolean is bool.
String is string.
Object is object.
List is IList.
HashMap is Dictionary.