Structural search for property get but not set

I'm trying to use structural search to find read (get) accesses to a property but not write (set) accesses.  In this case, it's for replacing assignments to an Infragistics UltraGridCell's Value property.  I want to replace

var x = ugr.Cells["foo"].Value;

with:

var x = ugr.GetCellValue("foo");

(where ugr is of type UltraGridRow)

but I don't want to replace:

ugr.Cells["foo"].Value = 7

with:

ugr.GetCellValue("foo").Value = 7;

(this won't compile).

I have a rule that works for the first case, where:

$ugr$.Cells[$key$].Value

is replaced with:

$ugr$.GetCellValue($key$)


Is there a way to make the rule not match the assignment to the property, only the read access?

Thanks,
Brian

Please sign in to leave a comment.