Baza znanjaCentar za ispite
HRHrvatski
Odaberi jezik13

CKTIS / C#

System.Reflection.Assembly: praktična referenca

System.Reflection.Assembly: praktična referenca: Assembly predstavlja učitanu jedinicu .NET koda i metapodataka.

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

Sintaksa

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

Assembly predstavlja učitanu jedinicu .NET koda i metapodataka.

Koristite za pregled tipova, resursa i naziva trenutačnog assembly.

Dinamičko učitavanje nosi rizik izvršavanja koda i sukoba konteksta učitavanja.

Location može biti prazan, a GetTypes može baciti ReflectionTypeLoadException.

Cijeli program doista koristi System.Reflection.Assembly; točno očekivani stdout jest System.Private.CoreLib.

Primjeri

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

Rezultat

System.Private.CoreLib

Cijeli program doista koristi `System.Reflection.Assembly`; točno očekivani stdout jest `System.Private.CoreLib`.

Izvori