Base de conocimientosCentro de exámenes
ESEspañol
Elegir idioma13

CKTIS / C#

System.Reflection.Assembly: referencia práctica

System.Reflection.Assembly: referencia práctica: Assembly representa una unidad .NET cargada de código y metadatos.

Versión: .NET API; verified against .NET 10 reference surface

Sintaxis

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

Assembly representa una unidad .NET cargada de código y metadatos.

Úsalo para inspeccionar tipos, recursos y el nombre del assembly actual.

La carga dinámica implica riesgo de ejecutar código y de crear conflictos entre contextos de carga.

Location puede estar vacío y GetTypes puede lanzar ReflectionTypeLoadException.

El programa completo usa realmente System.Reflection.Assembly; su stdout esperado exacto es System.Private.CoreLib.

Ejemplos

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);

Resultado

System.Private.CoreLib

El programa completo usa realmente `System.Reflection.Assembly`; su stdout esperado exacto es `System.Private.CoreLib`.

Fuentes