Pattern Catalog to convert string to lambda

I'm trying to convert statements like

  BindToText(nameTextEdit, instanceModel.EditItem, "Name");

to

  nameTextEdit.BindToText(instanceModel.EditItem, x=>x.Name);


I can write a pattern that will find the first and convert it to

  nameTextEdit.BindToText(instanceModel.EditItem, "Name");

but the rest eludes me. Specifying an ID placeholder and enclosing it in quotes doesn't work. I'd settle for

  nameTextEdit.BindToText(instanceModel.EditItem, x => x."Name");

using an expression of type string, but that doesn't work either. Any suggestions?

2 comments
Comment actions Permalink

TrueWillAtWork wrote:
<...>

but the rest eludes me. Specifying an ID placeholder and enclosing it in quotes doesn't work. <...>

FWIW, there's an issue about this: http://youtrack.jetbrains.net/issue/RSRP-183035 "Structural search and replace: Cannot perform replacement for identifier when using quotes around identifier in replace pattern."

0
Comment actions Permalink

Thanks! I added my vote for that issue.

0

Please sign in to leave a comment.