public static string Generate(ITypeSymbol symbol, AttributesMetadata attributesMetadata) { var code = ContainingTypesBuilder.Build(symbol, includeSelf: true, content: sb => { BuildEquals(symbol, attributesMetadata, sb); BuildGetHashCode(symbol, attributesMetadata, sb); }); return(code); }
public static string Generate(ITypeSymbol symbol, AttributesMetadata attributesMetadata) { var code = ContainingTypesBuilder.Build(symbol, includeSelf: false, content: sb => { var typeName = symbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat); sb.AppendLine($"partial class {typeName} : global::System.IEquatable<{typeName}> {{"); BuildEquals(symbol, attributesMetadata, sb); BuildGetHashCode(symbol, attributesMetadata, sb); sb.AppendLine("}"); }); return(code); }
public static string Generate(ITypeSymbol symbol, AttributesMetadata attributesMetadata, bool explicitMode) { var code = ContainingTypesBuilder.Build(symbol, includeSelf: true, content: sb => { sb.AppendLine(EnableNullableContext); sb.AppendLine(SuppressObsoleteWarningsPragma); BuildEquals(symbol, attributesMetadata, sb, explicitMode); BuildGetHashCode(symbol, attributesMetadata, sb, explicitMode); sb.AppendLine(RestoreObsoleteWarningsPragma); sb.AppendLine(RestoreNullableContext); }); return(code); }
public static string Generate(ITypeSymbol symbol, AttributesMetadata attributesMetadata, bool explicitMode) { var code = ContainingTypesBuilder.Build(symbol, includeSelf: false, content: sb => { var typeName = symbol.ToDisplayString(SymbolDisplayFormat.MinimallyQualifiedFormat); sb.AppendLine($"partial class {typeName} : global::System.IEquatable<{typeName}> {{"); sb.AppendLine(EnableNullableContext); sb.AppendLine(SuppressObsoleteWarningsPragma); BuildEquals(symbol, attributesMetadata, sb, explicitMode); BuildGetHashCode(symbol, attributesMetadata, sb, explicitMode); sb.AppendLine(RestoreObsoleteWarningsPragma); sb.AppendLine(RestoreNullableContext); sb.AppendLine("}"); }); return(code); }