for code review and problem solving purposes, I'd need to be able to overlook all property getters in a large solution. I'm thinking "Regex and Powershell to the rescue".
I'd need a rexeg pattern that matches all getters in a C# file. For example, if this was the test string:
public string MockFullName
{
get
{
string ns = FullName.Substring(0, FullName.Length - Name.Length - 1);
return string.Format("{0}.Mock{1}", ns, Name);
}
}
I'd need the match be:
get
{
string ns = FullName.Substring(0, FullName.Length - Name.Length - 1);
return string.Format("{0}.Mock{1}", ns, Name);
}
I've played around in https://regex101.com/ with pattern...
get(.|\n)*{(.|\n)*}
...which gives me too much back - includes the closing bracket from class too.
Typing this in PowerShell doesn't give anything back for the given C# file:
sls 'get(.|\n)*{(.|\n)*}' MyCSharpFileWithAProperty.cs
So, what kind of regex pattern would cater for this?
Thanks, pom
PS: For the record, I'm not interested in short form properties, and they can be skipped:
public string Name { get; set; }