Introducing C# Source Generators
От: Serginio1 СССР https://habrahabr.ru/users/serginio1/topics/
Дата: 01.05.20 12:06
Оценка: 147 (8)
https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/
Как то новость прошла без энтузиазма

Очень интересен пример AutoNotifyGenerator https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/SourceGeneratorSamples/AutoNotifyGenerator.cs
Пример использования атрибутов
https://github.com/dotnet/roslyn-sdk/blob/master/samples/CSharp/SourceGenerators/GeneratedDemo/UseAutoNotifyGenerator.cs
Раньше использовались Fody Refit которые Il код редактировали.
Ну и T4, правда бы еще и синтаксис типа разора

Так же собираются добавить partial методы отличных от void, ref параметры, private
https://github.com/jaredpar/csharplang/blob/partial/proposals/extending-partial-methods.md

partial on all members
Given that we're expanding partial to be more friendly to source generators should we also expand it to work on all class members? For example should we be able to declare partial constructors, operators, etc ...
Resolution The idea is sound but at this point in the C# 9 schedule we're trying to avoid unnecessary feature creep. Want to solve the immediate problem of expanding the feature to work with modern source generators.
Extending partial to support other members will be considered for the C# 10 release. Seems likely that we will consider this extension.



Еще
New C# Source Generator Samples
и солнце б утром не вставало, когда бы не было меня
Отредактировано 26.08.2020 9:03 Serginio1 . Предыдущая версия . Еще …
Отредактировано 26.05.2020 12:01 Serginio1 . Предыдущая версия .
Отредактировано 01.05.2020 13:36 Serginio1 . Предыдущая версия .
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.