An assembly is the fundamental building block of a dot NET application, typically a DLL or EXE file, that contains compiled code along with metadata describing that code, such as information about types, methods, versions, and referenced assemblies. Metadata acts like a detailed blueprint embedded directly inside the assembly, allowing the Common Language Runtime and development tools to understand exactly what the assembly contains without needing any separate external description files.
// Viewing assembly metadata using reflection
var assembly = typeof(Program).Assembly;
Console.WriteLine(assembly.FullName);
Real-world example
A tool that analyzes third party dot NET libraries reads their embedded metadata to automatically discover available classes and methods, without needing the original source code or any separate documentation file.
Likely follow-ups
What tools can be used to inspect an assembly's metadata?
What is the difference between a private assembly and a shared assembly?
Explain about BCL.What is the difference between an EXE and a DLL?
Managed code is code that runs under the control of the Common Language Runtime, which handles memory management through garbage collection, type safety, exception handling, and security, and all C# code compiled for dot NET falls into this category. Unmanaged code, on the other hand, runs directly on the operating system without the CLR's oversight, meaning the developer is responsible for manually managing memory allocation and deallocation, as is common in languages like C or C plus plus, which increases both flexibility and the risk of memory related bugs.
// Managed code: garbage collector handles cleanup automatically
var list = new List<int>();
// No manual memory deallocation required
Real-world example
A dot NET application that needs to call into an existing C plus plus library uses Platform Invoke to bridge managed code and unmanaged code, letting the two communicate despite having very different memory management models.
Likely follow-ups
What is Platform Invoke and when is it used?
Can managed code call unmanaged code directly?
Explain CLR and its Execution Process.What is the Just-In-Time (JIT) compilation?
C# is a modern, object oriented, and type safe programming language developed by Microsoft specifically for building applications on the dot NET platform. It combines the power and performance of languages like C plus plus with the productivity and simplicity of languages like Java, and it supports features such as strong typing, garbage collection, generics, LINQ, and async programming, making it a popular choice for building web applications, desktop software, games, and cloud services.
using System;
class Program {
static void Main() {
Console.WriteLine("Hello from C#");
}
}
Real-world example
A company building a cross platform business application chooses C# because it allows the same codebase, using shared business logic, to power a web API, a desktop application, and even a mobile app through different dot NET based frameworks.
Likely follow-ups
How does C# compare to Java in terms of syntax and features?
What versions of C# are currently supported?
What is exactly .NET?What are the new features introduced in C# 7?
An EXE, or executable file, is a standalone program that can be run directly by the operating system and typically contains an entry point, such as a Main method, that starts the application. A DLL, or Dynamic Link Library, contains reusable code, such as classes and methods, that is meant to be loaded and used by other programs or assemblies rather than run on its own, allowing multiple applications to share the same compiled functionality without duplicating code.
// A class library project compiles to a .dll
// A console app project compiles to a .exe
dotnet new classlib -o MyLibrary
dotnet new console -o MyApp
Real-world example
A company builds a shared DLL containing common validation logic that is then referenced by several different EXE applications across the organization, avoiding the need to duplicate that same logic in every project.
Likely follow-ups
Can a DLL be executed directly like an EXE?
How do you reference a DLL from another project?
What are Metadata and an assembly?Explain about BCL.