CKTIS / C#
reflection and expressions: referencia práctica
reflection and expressions: referencia práctica: La reflexión lee metadatos y opera dinámicamente con tipos y miembros.
Versión: C# language and .NET 10 reference runtime
Sintaxis
// reflectionLa reflexión lee metadatos y opera dinámicamente con tipos y miembros.
Úsala en límites controlados del framework y almacena en caché búsquedas costosas.
Pierde controles del compilador, complica trimming y AOT y puede ejecutar código del usuario.
Miembros ausentes, sobrecargas, genéricos y accesibilidad requieren tratamiento inequívoco.
El programa completo usa realmente reflection and expressions; su stdout esperado exacto es Name.
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 properties = typeof(Person).GetProperties(); Console.WriteLine(properties.Single().Name); sealed record Person(string Name);
Resultado
Name
El programa completo usa realmente `reflection and expressions`; su stdout esperado exacto es `Name`.