private void AppendEvent(DescriptionBuilder sb, NetBrowserManager manager, EventInfo eventInfo) { sb.Append(Settings.GetKeyword(MemberTypes.Event)); sb.Append(" "); NetTypeBrowserInfo.AppendParameterTypeDisplayName(manager, sb, eventInfo.EventHandlerType, false, true); sb.Append(" "); sb.AppendName(eventInfo.Name); }
private void AppendProperty(DescriptionBuilder sb, NetBrowserManager manager, PropertyInfo property) { // Properties have many of the same attributes as methods, but these attributes are declared // on the accessors, not on the properties themselves. MethodInfo[] accessors = property.GetAccessors(true); Debug.Assert(accessors.Length > 0, "Unable to get the accessors for property '" + property.DeclaringType.ToString() + "." + property.Name + "' - this property should not have been displayed."); AppendMethodAttributes(sb, accessors[0]); NetTypeBrowserInfo.AppendParameterTypeDisplayName(manager, sb, property.PropertyType, false, true); sb.Append(" "); sb.AppendName(property.Name); if (property.CanRead) { if (property.CanWrite) { sb.Append(" [ get, set ]"); } else { sb.Append(" [ get ]"); } } else if (property.CanWrite) { sb.Append(" [ set ]"); } else { Debug.Fail("Property '" + property.Name + "' is not readable and not writeable."); } // Show indexer parameters as well (which the VS.NET object browser doesn't do). ParameterInfo[] indexers = property.GetIndexParameters(); if (indexers.Length > 0) { sb.Append(" ( "); AppendParameters(sb, manager, indexers); sb.Append(" )"); } }
private void AppendField(DescriptionBuilder sb, NetBrowserManager manager, FieldInfo field) { AppendFieldAttribute(sb, field, FieldAttributes.Static); AppendFieldAttribute(sb, field, FieldAttributes.InitOnly); AppendFieldAttribute(sb, field, FieldAttributes.Literal); NetTypeBrowserInfo.AppendParameterTypeDisplayName(manager, sb, field.FieldType, false, true); sb.Append(" "); sb.AppendName(field.Name); // Show values of constants, static readonly variables and enum identifiers. if (field.IsLiteral || (field.IsStatic && field.IsInitOnly)) { sb.Append(" = "); sb.Append(GetConstantDisplayValue(field.GetValue(null), true)); } }
private void AppendMethod(DescriptionBuilder sb, NetBrowserManager manager, MethodInfo method) { AppendMethodAttributes(sb, method); NetTypeBrowserInfo.AppendParameterTypeDisplayName(manager, sb, method.ReturnType, false, true); sb.Append(" "); if (MethodIsOperator(method)) { sb.AppendName(Settings.GetKeyword(method.Name)); } else { sb.AppendName(method.Name); } sb.Append(" ( "); AppendParameters(sb, manager, method.GetParameters()); sb.Append(" )"); }