| 1 |
using Mono.Cecil; |
| 2 |
using Mono.Collections.Generic; |
| 3 |
|
| 4 |
namespace Mono.Documentation.Util |
| 5 |
{ |
| 6 |
public class AttachedPropertyDefinition : AttachedPropertyReference, IMemberDefinition |
| 7 |
{ |
| 8 |
private readonly FieldDefinition fieldDefinition; |
| 9 |
|
| 10 |
public AttachedPropertyDefinition(FieldDefinition fieldDefinition, MetadataToken metadataToken) : base(fieldDefinition) |
| 11 |
{ |
| 12 |
this.fieldDefinition = fieldDefinition; |
| 13 |
MetadataToken = metadataToken; |
| 14 |
} |
| 15 |
|
| 16 |
public MemberReference GetMethod |
| 17 |
{ |
| 18 |
get => this.DeclaringType.GetMember( |
| 19 |
$"Get{AttachedEntitiesHelper.GetPropertyName(fieldDefinition.Name)}", |
| 20 |
m => (m as MethodReference)?.Parameters.Count == 1); |
| 21 |
} |
| 22 |
public MemberReference SetMethod |
| 23 |
{ |
| 24 |
get => this.DeclaringType.GetMember( |
| 25 |
$"Set{AttachedEntitiesHelper.GetPropertyName(fieldDefinition.Name)}", |
| 26 |
m => (m as MethodReference)?.Parameters.Count == 2); |
| 27 |
} |
| 28 |
|
| 29 |
public Collection<CustomAttribute> CustomAttributes => fieldDefinition.CustomAttributes; |
| 30 |
public bool HasCustomAttributes => fieldDefinition.HasCustomAttributes; |
| 31 |
|
| 32 |
public bool IsSpecialName |
| 33 |
{ |
| 34 |
get { return fieldDefinition.IsSpecialName; } |
| 35 |
set { fieldDefinition.IsSpecialName = value; } |
| 36 |
} |
| 37 |
|
| 38 |
public bool IsRuntimeSpecialName |
| 39 |
{ |
| 40 |
get { return fieldDefinition.IsRuntimeSpecialName; } |
| 41 |
set { fieldDefinition.IsRuntimeSpecialName = value; } |
| 42 |
} |
| 43 |
|
| 44 |
public new TypeDefinition DeclaringType |
| 45 |
{ |
| 46 |
get { return fieldDefinition.DeclaringType; } |
| 47 |
set { fieldDefinition.DeclaringType = value; } |
| 48 |
} |
| 49 |
} |
| 50 |
} |