本文整理汇总了C#中IPropertyDefinition.GetHiddenBaseProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertyDefinition.GetHiddenBaseProperty方法的具体用法?C# IPropertyDefinition.GetHiddenBaseProperty怎么用?C# IPropertyDefinition.GetHiddenBaseProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertyDefinition
的用法示例。
在下文中一共展示了IPropertyDefinition.GetHiddenBaseProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritePropertyDefinition
private void WritePropertyDefinition(IPropertyDefinition property)
{
bool isInterfaceProp = property.ContainingTypeDefinition.IsInterface;
IMethodDefinition accessor = null;
IMethodDefinition getter = null;
IMethodDefinition setter = null;
if (property.Getter != null)
{
getter = property.Getter.ResolvedMethod;
if (!_filter.Include(getter))
getter = null;
accessor = getter;
}
if (property.Setter != null)
{
setter = property.Setter.ResolvedMethod;
if (!_filter.Include(setter))
setter = null;
if (accessor == null)
accessor = setter;
}
if (accessor == null)
return;
bool isIndexer = accessor.ParameterCount > (accessor == setter ? 1 : 0);
if (isIndexer)
{
string id = property.Name.Value;
int index = id.LastIndexOf(".");
if (index >= 0)
id = id.Substring(index + 1);
if (id != "Item")
{
WriteFakeAttribute("System.Runtime.CompilerServices.IndexerName", "\"" + id + "\"");
}
}
WriteAttributes(property.Attributes);
if (!isInterfaceProp)
{
if (!accessor.IsExplicitInterfaceMethod())
WriteVisibility(property.Visibility);
// Getter and Setter modifiers should be the same
WriteMethodModifiers(accessor);
}
if (property.GetHiddenBaseProperty(_filter) != Dummy.Property)
WriteKeyword("new");
WriteTypeName(property.Type);
if (isIndexer)
{
int index = property.Name.Value.LastIndexOf(".");
if (index >= 0)
WriteIdentifier(property.Name.Value.Substring(0, index + 1) + "this", false); // +1 to include the '.'
else
WriteIdentifier("this", false);
var parameters = new List<IParameterDefinition>(accessor.Parameters);
if (accessor == setter) // If setter remove value parameter.
parameters.RemoveAt(parameters.Count - 1);
WriteParameters(parameters, true);
}
else
{
WriteIdentifier(property.Name);
}
WriteSpace();
WriteSymbol("{");
//get
if (getter != null)
{
WriteAccessorDefinition(property, getter, "get");
}
//set
if (setter != null)
{
WriteAccessorDefinition(property, setter, "set");
}
WriteSpace();
WriteSymbol("}");
}