CKTIS / C#
System.Type: odniesienie praktyczne
System.Type: odniesienie praktyczne: Type reprezentuje metadane typu uruchomieniowego, w tym generic definition i składniki.
Wersja: .NET API; verified against .NET 10 reference surface
Składnia
System.Type /* select a documented member or constructor */Type reprezentuje metadane typu uruchomieniowego, w tym generic definition i składniki.
Stosuj do refleksji, fabryk i kontroli assignability.
Porównuj Type lub używaj IsAssignableFrom; nazwa tekstowa nie koduje całej tożsamości assembly.
GetType(string) może zwrócić null; typ generic otwarty nie może zostać zwyczajnie utworzony.
Kompletny program rzeczywiście używa System.Type; oczekiwany stdout to dokładnie True.
Przykłady
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;
Type type = typeof(Dictionary<string, int>);
Console.WriteLine(type.IsGenericType);
Wynik
True
Kompletny program rzeczywiście używa `System.Type`; oczekiwany stdout to dokładnie `True`.