Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / C#

System.Reflection.Assembly: practical reference

System.Reflection.Assembly: practical reference: Assembly represents a loaded .NET unit of code and metadata.

Version: .NET API; verified against .NET 10 reference surface

Syntax

System.Reflection.Assembly /* select a documented member or constructor */

Assembly represents a loaded .NET unit of code and metadata.

Use it to inspect types, resources, and the name of the current assembly.

Dynamic loading risks executing code and creating load-context conflicts.

Location can be empty, and GetTypes can throw ReflectionTypeLoadException.

The complete program actually uses System.Reflection.Assembly; its exact expected stdout is System.Private.CoreLib.

Examples

using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;

var assembly = typeof(string).Assembly;
Console.WriteLine(assembly.GetName().Name);

Result

System.Private.CoreLib

The complete program actually uses `System.Reflection.Assembly`; its exact expected stdout is `System.Private.CoreLib`.

Sources