From 048207425b0efb602cb3da5ca9377352ac7ed5a5 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Fri, 28 Jul 2017 12:56:20 +0200 Subject: [PATCH] Correct method generation to account for SA1001. --- src/Generator.Bind/CSharpSpecWriter.cs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Generator.Bind/CSharpSpecWriter.cs b/src/Generator.Bind/CSharpSpecWriter.cs index f9c00c7f..003cc71d 100644 --- a/src/Generator.Bind/CSharpSpecWriter.cs +++ b/src/Generator.Bind/CSharpSpecWriter.cs @@ -662,15 +662,13 @@ namespace Bind if (f.Parameters.HasGenericParameters) { sb.Append("<"); - foreach (Parameter p in f.Parameters) + foreach (Parameter p in f.Parameters.Where(p => p.Generic)) { - if (p.Generic) - { - sb.Append(p.CurrentType); - sb.Append(","); - } + sb.Append(p.CurrentType); + sb.Append(", "); } - sb.Remove(sb.Length - 1, 1); + + sb.Remove(sb.Length - 2, 2); sb.Append(">"); } @@ -679,12 +677,9 @@ namespace Bind if (f.Parameters.HasGenericParameters) { sb.AppendLine(); - foreach (Parameter p in f.Parameters) + foreach (Parameter p in f.Parameters.Where(p => p.Generic)) { - if (p.Generic) - { - sb.AppendLine(String.Format(" where {0} : struct", p.CurrentType)); - } + sb.AppendLine(String.Format(" where {0} : struct", p.CurrentType)); } }