protected override IEnumerable <MemberDeclarationSyntax> BuildMembers(CancellationToken cancellation) { foreach (IPropertyInfo ifaceProperty in Context.InterfaceType.Properties) { cancellation.ThrowIfCancellationRequested(); IPropertyInfo targetProperty = GetTargetMember(ifaceProperty, Context.TargetType.Properties); // // Ellenorizzuk h a property lathato e a legeneralando szerelvenyunk szamara. // Visibility.Check ( targetProperty, Context.ContainingAssembly, checkGet: ifaceProperty.GetMethod is not null, checkSet: ifaceProperty.SetMethod is not null ); IMethodInfo accessor = targetProperty.GetMethod ?? targetProperty.SetMethod !; // // Ne a "targetProperty"-n hivjuk h akkor is jol mukodjunk ha az interface indexerenek // maskepp vannak elnvezve a parameterei. // ExpressionSyntax propertyAccess = PropertyAccess ( ifaceProperty, MemberAccess(null, TARGET), castTargetTo: accessor.AccessModifiers == AccessModifiers.Explicit ? accessor.DeclaringInterfaces.Single() // explicit tulajdonsaghoz biztosan csak egy deklaralo interface tartozik : null ); // // Nem gond ha mondjuk az interface property-nek nincs gettere, akkor a "getBody" // figyelmen kivul lesz hagyva. // ArrowExpressionClauseSyntax getBody = ArrowExpressionClause ( expression: propertyAccess ), setBody = ArrowExpressionClause ( expression: AssignmentExpression ( kind: SyntaxKind.SimpleAssignmentExpression, left: propertyAccess, right: IdentifierName(Value) ) ); yield return(ifaceProperty.Indices.Any() ? DeclareIndexer ( property: ifaceProperty, getBody: getBody, setBody: setBody, forceInlining: true ) : (MemberDeclarationSyntax)DeclareProperty ( property: ifaceProperty, getBody: getBody, setBody: setBody, forceInlining: true )); } }