CKTIS / C#
System.Type: praktična referenca
System.Type: praktična referenca: Type predstavlja metapodatke tipa tijekom izvođenja, uključujući generičke definicije i članove.
Verzija: .NET API; verified against .NET 10 reference surface
Sintaksa
System.Type /* select a documented member or constructor */Type predstavlja metapodatke tipa tijekom izvođenja, uključujući generičke definicije i članove.
Koristite za refleksiju, tvornice i provjere dodjeljivosti.
Uspoređujte vrijednosti Type ili koristite IsAssignableFrom; tekstni naziv ne kodira cijeli identitet assembly.
GetType(string) može vratiti null; otvoreni generički tip ne može se obično stvoriti.
Cijeli program doista koristi System.Type; točno očekivani stdout jest True.
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;
Type type = typeof(Dictionary<string, int>);
Console.WriteLine(type.IsGenericType);
Rezultat
True
Cijeli program doista koristi `System.Type`; točno očekivani stdout jest `True`.