diff --git a/CodeConverter/CSharp/ExpressionNodeVisitor.cs b/CodeConverter/CSharp/ExpressionNodeVisitor.cs index 9007ce94..fd76a9c6 100644 --- a/CodeConverter/CSharp/ExpressionNodeVisitor.cs +++ b/CodeConverter/CSharp/ExpressionNodeVisitor.cs @@ -1884,14 +1884,14 @@ private RefConversion NeedsVariableForArgument(VBasic.Syntax.ArgumentSyntax node RefConversion GetRefConversion(VBSyntax.ExpressionSyntax expression) { var symbolInfo = GetSymbolInfoInDocument(expression); - if (symbolInfo is IPropertySymbol propertySymbol - // a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references - && !propertySymbol.ReturnsByRef && !propertySymbol.ReturnsByRefReadonly) { + if (symbolInfo is IPropertySymbol { ReturnsByRef: false, ReturnsByRefReadonly: false } propertySymbol) { + // a property in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references return propertySymbol.IsReadOnly ? RefConversion.PreAssigment : RefConversion.PreAndPostAssignment; } else if (symbolInfo is IFieldSymbol { IsConst: true } or ILocalSymbol { IsConst: true }) { return RefConversion.PreAssigment; - } else if (symbolInfo is IMethodSymbol) { + } else if (symbolInfo is IMethodSymbol { ReturnsByRef: false, ReturnsByRefReadonly: false }) { + // a method in VB.NET code can be ReturnsByRef if it's defined in a C# assembly the VB.NET code references return RefConversion.PreAssigment; }