Exemplo n.º 1
0
        private static EqualsValueClauseSyntax GenerateEqualsValue(IFieldSymbol field)
        {
            if (field.HasConstantValue)
            {
                var canUseFieldReference = field.Type != null && !field.Type.Equals(field.ContainingType);
                return(SyntaxFactory.EqualsValueClause(ExpressionGenerator.GenerateExpression(field.Type, field.ConstantValue, canUseFieldReference)));
            }

            return(null);
        }
Exemplo n.º 2
0
 private static ExpressionSyntax GenerateEqualsValueClauseWorker(
     IParameterSymbol parameter,
     object value)
 {
     return(ExpressionGenerator.GenerateExpression(parameter.Type, value, canUseFieldReference: true));
 }