Изменения документа Сценарии

Редактировал(а) Alexandr Fokin 2025/05/13 13:04

От версии 2.2
отредактировано Alexandr Fokin
на 2023/02/08 13:12
Изменить комментарий: К данной версии нет комментариев
К версии 2.3
отредактировано Alexandr Fokin
на 2023/05/31 09:56
Изменить комментарий: К данной версии нет комментариев

Сводка

Подробности

Свойства страницы
Содержимое
... ... @@ -19,7 +19,18 @@
19 19  How do I set a field value in an C# Expression tree?
20 20  [[https:~~/~~/stackoverflow.com/questions/321650/how-do-i-set-a-field-value-in-an-c-sharp-expression-tree>>https://stackoverflow.com/questions/321650/how-do-i-set-a-field-value-in-an-c-sharp-expression-tree]]
21 21  )))
22 +|(% style="width:432px" %)Вызов конструктора|(% style="width:1061px" %){{code language="c#"}}var constructorInfo = t.GetConstructors().First(e => e.Attributes.HasFlag(MethodAttributes.Public));
23 +var constructorParameter1 = Expression.Parameter(typeof(bool));
24 +var constructorExp = Expression.New(constructorInfo, constructorParameter1);
22 22  
26 +// Func<bool, object> or Func<bool, T>
27 +var constructorDelegate = Expression
28 + .Lambda<Func<bool, object>>(
29 + constructorExp,
30 + deletedParameter
31 + )
32 + .Compile();{{/code}}
33 +
23 23  ==== ====
24 24  
25 25  ==== ====
... ... @@ -37,4 +37,3 @@
37 37  
38 38  ----
39 39  
40 -