ICSharpCode.NRefactory.Ast.AssignmentExpression.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            return string.Format("[AssignmentExpression Left={0} Op={1} Right={2}]", Left, Op, Right);
        }

Usage Example

            public override object TrackedVisitAssignmentExpression(AssignmentExpression assignmentExpression, object data)
            {
                if (this.FoundResourceSet == null &&	// skip if already found to improve performance
                    assignmentExpression.Op == AssignmentOperatorType.Assign && this.PositionAvailable &&
                    (!this.isLocalVariable || this.resourceManagerMember.Region.IsInside(this.CurrentNodeStartLocation.Y, this.CurrentNodeStartLocation.X))	// skip if local variable is out of scope
                   ) {

                    IMember resolvedMember = null;
                    ResolveResult rr = this.Resolve(assignmentExpression.Left);
                    if (rr != null) {
                        // Support both local variables and member variables
                        MemberResolveResult mrr = rr as MemberResolveResult;
                        if (mrr != null) {
                            resolvedMember = mrr.ResolvedMember;
                        } else {
                            LocalResolveResult lrr = rr as LocalResolveResult;
                            if (lrr != null) {
                                resolvedMember = lrr.Field;
                            }
                        }
                    }

                    if (resolvedMember != null) {

                        #if DEBUG
                        LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver: Resolved member: "+resolvedMember.ToString());
                        #endif

                        // HACK: The GetType()s are necessary because the DOM IComparable implementations try to cast the parameter object to their own interface type which may fail.
                        if (resolvedMember.GetType().Equals(this.resourceManagerMember.GetType()) && resolvedMember.CompareTo(this.resourceManagerMember) == 0) {

                            #if DEBUG
                            LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found assignment to field: "+assignmentExpression.ToString());
                            #endif
                            data = true;

                            // Resolving the property association only makes sense if
                            // there is a possible relationship between the return types
                            // of the resolved member and the member we are looking for.
                        } else if (this.compilationUnit != null && !this.isLocalVariable &&
                                   IsTypeRelationshipPossible(resolvedMember, this.resourceManagerMember)) {

                            if (this.resourceManagerMember is IProperty && resolvedMember is IField) {
                                // Find out if the resourceManagerMember is a property whose get block returns the value of the resolved member.

                                // We might already have found this association in the
                                // resourceManagerFieldAccessedByProperty field.
                                this.TryResolveResourceManagerProperty();

                                if (this.resourceManagerFieldAccessedByProperty != null && this.resourceManagerFieldAccessedByProperty.CompareTo(resolvedMember) == 0) {
                                    #if DEBUG
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found assignment to field: "+assignmentExpression.ToString());
                                    #endif
                                    data = true;
                                }

                            } else if (this.resourceManagerMember is IField && resolvedMember is IProperty) {
                                // Find out if the resolved member is a property whose set block assigns the value to the resourceManagerMember.

                                PropertyFieldAssociationVisitor visitor = new PropertyFieldAssociationVisitor((IField)this.resourceManagerMember, this.FileName, this.FileContent);
                                this.compilationUnit.AcceptVisitor(visitor, null);
                                if (visitor.AssociatedProperty != null && visitor.AssociatedProperty.CompareTo(resolvedMember) == 0) {
                                    #if DEBUG
                                    LoggingService.Debug("ResourceToolkit: BclNRefactoryResourceResolver found assignment to property: "+assignmentExpression.ToString());
                                    #endif
                                    data = true;
                                }

                            }

                        }

                    }

                }
                return base.TrackedVisitAssignmentExpression(assignmentExpression, data);
            }