File tree Expand file tree Collapse file tree
tools/DataProc/src/Services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public async Task<Result> Run() {
5050
5151 var prompt = PromptBuilder . Create ( PromptTemplates . PostsRetrospectiveArchitectUnboxingEdition )
5252 . AddParameter ( "time_range" , "2023-2026年" )
53- . AddParameter ( "posts" , Json . Dumps ( metadatas ) )
53+ . AddParameter ( "posts" , Json . Dumps ( metadatas ) )
5454 . Build ( ) ;
5555
5656 Console . WriteLine ( prompt ) ;
@@ -71,21 +71,14 @@ Dictionary<string, string> Sections
7171// dotnet10 新的扩展成员(Extension Members)语法
7272public static class MyExtensions {
7373 extension ( Post post ) {
74- // 1. 扩展属性 (以前做不到)
7574 public string SimpleExtProp => "hello";
7675
77- // 2. 扩展方法 (不再需要写 static 和 this)
7876 public string GetSection ( string title ) {
7977 return ExtractSectionRegex ( post . Content , title ) ;
8078 }
8179
8280 public Dictionary < string , string > GetSections ( params string [ ] titles ) {
83- var dict = new Dictionary < string , string > ( ) ;
84- foreach ( var title in titles ) {
85- dict . Add ( title , post . GetSection ( title ) ) ;
86- }
87-
88- return dict ;
81+ return titles . ToDictionary ( title => title , post . GetSection ) ;
8982 }
9083 }
9184
You can’t perform that action at this time.
0 commit comments