Replies: 0 comments 2 replies
-
@ltrzesniewski reminded me that you can of course apply the attribute to the setter parameter by: public TraceInterpolatedStringHandler this[string index]
{
[param: InterpolatedStringHandlerArgument("")]
set { _nameToValue[index] = value.GetFormattedText(); }
} However, the compiler does not use this and still uses This might be more of a C# language issue so should perhaps raise that there instead. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to define an API that supports using
InterpolatedStringHandler
onset_Item
for an indexer. This works but similar to how you can forward the instance of the type which a method belongs to by usingInterpolatedStringHandlerArgument
I'd like to do that for the indexer too. That is define theset_Item
likeset_Item2
as shown below, and then have C# support that. For now I don't know how to actually applyInterpolatedStringHandlerArgument
tovalue
to get it to callTraceInterpolatedStringHandler(int literalLength, int formattedCount, Row row)
. How can I bend things to get this working?PS: One option would be to use a ThreadLocal variable 😱
sharplab.io
If you run
C_Test
this outputs something like:Beta Was this translation helpful? Give feedback.
All reactions