CKTIS / C#
System.Reflection.PropertyInfo: практическа справка
System.Reflection.PropertyInfo: практическа справка: PropertyInfo описва свойство и неговите средства за достъп get и set.
Версия: .NET API; verified against .NET 10 reference surface
Синтаксис
System.Reflection.PropertyInfo /* select a documented member or constructor */PropertyInfo описва свойство и неговите средства за достъп get и set.
Използвайте за съпоставяне на данни и инструменти, които зачитат наличността на средствата за достъп.
Индексирано свойство изисква индексни аргументи, а getter може да изпълни произволен код.
Проверете за липсващ get или set; trimming може да премахне метаданни.
Пълната програма действително използва System.Reflection.PropertyInfo; точният очакван stdout е 3.
Примери
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 property = typeof(string).GetProperty(nameof(string.Length))!;
Console.WriteLine(property.GetValue("abc"));
Резултат
3
Пълната програма действително използва `System.Reflection.PropertyInfo`; точният очакван stdout е `3`.