views:

93

answers:

0

I need to switch my CodeProperty between read only and read / write. I can achive this with Edit points and ReplaceText so:

if(readOnly)
{
 CodeFunction setter = codeProperty.Setter;
 TextPoint start = setter.StartPoint;
 TextPoint end = setter.EndPoint;
 start.CreateEditPoint().ReplaceText(end, string.Empty, 0);
}
else
{
 CodeFunction getter = codeProperty.Getter;
 TextPoint start = getter.EndPoint;
 TextPoint end = getter.EndPoint;
 start.CreateEditPoint().ReplaceText(end, setterText, 0);
}

This isn't elegant but it works for C#, however in VB.NET I also need to set the ReadOnly keyword. Is there a better way of doing this?