string GetPropertyMarkup (IPropertySymbol property)
{
if (property == null)
throw new ArgumentNullException ("property");
var result = new StringBuilder ();
AppendModifiers (result, property);
result.Append (GetTypeReferenceString (property.Type));
if (BreakLineAfterReturnType) {
result.AppendLine ();
} else {
result.Append (" ");
}
AppendExplicitInterfaces (result, property.ExplicitInterfaceImplementations.Cast<ISymbol> ());
if (property.IsIndexer) {
result.Append (Highlight ("this", colorStyle.KeywordAccessors));
} else {
result.Append (HighlightSemantically (FilterEntityName (property.Name), colorStyle.UserPropertyDeclaration));
}
if (property.Parameters.Length > 0) {
// if (formattingOptions.SpaceBeforeIndexerDeclarationBracket)
// result.Append (" ");
result.Append ("[");
AppendParameterList (result, property.Parameters,
false /*formattingOptions.SpaceBeforeIndexerDeclarationParameterComma*/,
false /*formattingOptions.SpaceAfterIndexerDeclarationParameterComma*/);
result.Append ("]");
}
result.Append (" {");
if (property.GetMethod != null && IsAccessibleOrHasSourceCode (property.GetMethod)) {
if (property.GetMethod.DeclaredAccessibility != property.DeclaredAccessibility) {
result.Append (" ");
AppendAccessibility (result, property.GetMethod);
}
result.Append (Highlight (" get", colorStyle.KeywordProperty) + ";");
}
if (property.SetMethod != null && IsAccessibleOrHasSourceCode (property.SetMethod)) {
if (property.SetMethod.DeclaredAccessibility != property.DeclaredAccessibility) {
result.Append (" ");
AppendAccessibility (result, property.SetMethod);
}
result.Append (Highlight (" set", colorStyle.KeywordProperty) + ";");
}
result.Append (" }");
return result.ToString ();
}