2013-10-20 2 views

답변

1

ObjectConstruction.NamedArguments 사전을 사용하여 사용자 지정 특성의 속성을 설정할 수 있습니다. 예를 들어

:

public IEnumerable<AspectInstance> ProvideAspects(object targetElement) 
{ 
    Type targetType = (Type) targetElement; 

    var objectConstruction = 
     new ObjectConstruction(typeof (MyCustomAttribute).GetConstructor(Type.EmptyTypes)); 
    objectConstruction.NamedArguments["Bar"] = "Baz"; 

    var introduceAttributeAspect = new CustomAttributeIntroductionAspect(objectConstruction); 

    yield return new AspectInstance(targetType, introduceAttributeAspect); 
}