CompositeFormat - getting the templates #117659
Replies: 2 comments 2 replies
-
Can you elaborate on this part? CompositeFormat works with standard composite format strings, where the contents of the placeholders are numbers, not names. CompositeFormat does not support arbitrary strings like you find in logging; functionality like LoggerMessage.Define is responsible for parsing its own name-based scheme and translating that into a numeric scheme that CompositeFormat then uses. |
Beta Was this translation helpful? Give feedback.
-
@DL444 My plan was do simply use the order in the list of template names to provide the args in the correct order. Since the original API idea didn't offer this out of the box, I would have done that manually. Bascially, I saw that dotnet takes care of the heavy lifting that is parsing the format string and extracting the named placeholders (plus then creating a formatted string efficiently) and I could use that to build features. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In #50330, the original proposal containted the option of getting the list of templates parsed from the string. This would allow formatting the string using name matching. The final API proposal and implemented version (#50330 (comment)) no longer offers this information, even though it's preserved as internal information in CompositeFormat.
I looked into the discussion and information by @stephentoub but coudn't find details on why this part of the API was dropped and am hopeing on more information what I'm missing / if this is planned in the future?
Many thanks, Michael
Beta Was this translation helpful? Give feedback.
All reactions