What is .net framwork?
The .NET Framework is a software development platform developed by
Microsoft. It provides a comprehensive and consistent programming model
for building and running applications on Windows operating systems.
Diff bet .net core and framework?
.Net core .Net framework
Cross-platform,can be run on windows,mac and linux only for windows
Has moew frequent and regular updates updates are typically
tied to windows upd
With the introduction of ".NET 5+" (starting with .NET 5 and continued
with .NET 6 and beyond), Microsoft aimed to unify the benefits
of both .NET Core and the .NET Framework. This unified platform provides
cross-platform compatibility, performance improvements, a larger set of
APIs, and modern development capabilities.
Compilation Process(How we excute the code)
Code->CIL(MSIL)->(jit)->Native code/machine code->code will be excuted by processor
In .NET, code is compiled into an intermediate language (IL) called Common
Intermediate Language (CIL) or Microsoft Intermediate Language (MSIL).
The compilation process consists of several steps, which can be broadly divided into
three phases: source code compilation, IL generation, and native code
generation.
Source code compilation: This is the first phase of the compilation process, in
which the source code is compiled into CIL code. Each .NET language has its
own compiler that can convert the source code into CIL code. The output of this
phase is a CIL assembly, which is a single file containing the CIL code and metadata
about the types defined in the assembly.
. IL generation: In this phase, the CIL code is generated from the source code.
The CIL code is a low-level, platform-independent representation of the code,
designed to be executed by the .NET runtime environment. The CIL code contains
instructions that define the behavior of the code, such as loading values from
memory, performing mathematical operations, and calling methods.
3. Native code generation: The final phase of the compilation process is the
generation of native code from the CIL code. When an application is executed,
the .NET JIT compiler translates the CIL code into native machine code, which can
be executed by the processor. The JIT compiler optimizes the code for the specific
platform and environment in which the application is running, making it more efficient
and improving performance.
{
COMPILER CONVERTS OUR SOURCE CODE INTO MSIL/CIL .
CIL CODE CONTAINS INSTRUCTION THAT DEFINES BEHAVIOUR OF CODE SUCH AS LOADING
VALUES FROM MEMORY ,PERFORMING MATHEMATICAL OPERATIONS ,CALLING METHODS
AFTER THAT , EITH HELP OF JIT COMPILER CIL CODE IS CONVERTED INTO MACHINE READBLE
CODE WHICH CAN BE EXCUTED BY PROCESSOR
}
The compilation process in .NET has several benefits, including:
- Platform independence: Because the CIL code is platform-independent,
applications can be developed and compiled on one platform and run on
another, without modification.
- Code security: The compilation process can help to improve the security
of .NET applications, as the CIL code is compiled into native code at runtime
and cannot be directly executed by the operating system.
- Performance optimization: The JIT compiler can optimize the code for the
specific platform and environment in which the application is running, making
it more efficient and improving performance.
Overall, the compilation process in .NET is a critical component of the .NET runtime
environment, allowing developers to write code in their preferred language and
compile it into platform-independent CIL code. The CIL code is then translated into
native machine code at runtime by the .NET JIT compiler, providing improved
performance and security.
What is NAMESPACE
- In .NET programming, a namespace is a container that organizes and groups related
classes, interfaces and other types.
- Namespaces provide a hierarchical way to structure your code, similar to how folders
are used to organize files in a file system.
- They are also used to avoid naming collisions between types from different libraries
or projects.
What is ASSBLIES
In .NET, an assembly is a fundamental unit of deployment, version control, and code reuse.
It's a compiled collection of code files, resources (such as images, XML files, etc.), and
metadata that together form a logical unit of functionality.
Assemblies can be of two types:
Single-File Assemblies: These assemblies consist of a single executable file (with a .exe
extension) or a single dynamic link library (DLL) file. They are generally used for simple
applications or libraries.
Multi-File Assemblies: These assemblies consist of multiple files, often including a primary
DLL or EXE file and additional satellite assemblies containing resources or other components.
Assemblies have the following properties:
Assemblies are implemented as .exe or .dll files.
For libraries that target .NET Framework, you can share assemblies between applications by
putting them in the global assembly cache (GAC). You must strong-name assemblies before
you can include them in the GAC. For more information, see Strong-named assemblies.
Assemblies are only loaded into memory if they're required. If they aren't used, they aren't
loaded. Therefore, assemblies can be an efficient way to manage resources in larger projects.
What is DLL & EXE
In the context of .NET programming, DLL and EXE are two types of files that contain
compiled code and resources for running software applications. They serve different
purposes within a software ecosystem.
DLL (Dynamic Link Library):
A DLL is a file containing compiled code and resources that multiple programs can use
simultaneously.
It's designed for code reuse and modularity. Multiple applications can link to and use the
functions and resources provided by a DLL.
DLLs allow for shared code among applications, reducing redundancy and making
maintenance easier.
Common DLL use cases include libraries for user interface controls, database connectivity,
encryption, and more.
DLLs are not standalone executable files; they require a host application (typically an EXE)
to call their functions.
EXE (Executable):
An EXE is a standalone file that contains compiled code and resources required to run a
specific program.
It's designed to be run directly by the user or the operating system to execute a particular
software application.
EXE files define the entry point of an application, where execution begins.
Each EXE file corresponds to a distinct application, and it can include its own resources,
user interface, logic, and functionalities.
Unlike DLLs, EXE files are meant to be executed independently and don't need a host
application to run.
In summary, DLLs and EXEs are both types of files that contain compiled code and
resources. DLLs are designed for code reuse and sharing among multiple applications,
while EXEs are standalone executable files that represent individual software applications.
What is Bin folder
In the context of .NET development, the "bin" folder (short for "binary") is a directory that
holds the compiled binary files of your application.
When you build your .NET project, the compiler generates the executable or DLL along
with its associated files, and places them in the "bin" folder. This folder is typically
organized further into subfolders based on the target framework and build configuration
The "bin" folder is crucial during development and testing, as it's where your compiled code
is stored for running and debugging. However, it's not typically included in version control
systems, as the compiled files can be regenerated by building the project. It's recommended
to exclude the "bin" and "obj" (object) folders from version control repositories to avoid
duplication and potential issues.
In summary, the "bin" folder in .NET contains the compiled binary files of your application,
including executables, DLLs, and dependencies needed to run your code.