Skip to content

Commit 2d24414

Browse files
committed
🔧 Fix(Dumpper): Fix #13 .
1 parent a824270 commit 2d24414

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

Common.BasicHelper/Utils/Extensions/Dumpper.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ public static string[] Dump2Lines(this NetworkInterface adapter, bool print = tr
150150
/// 任意类型打印机
151151
/// </summary>
152152
/// <param name="src">打印对象</param>
153-
public static string Print<T>(this T? src)
153+
public static string Print<T>(this T? src, bool print = true)
154154
{
155-
Console.WriteLine(src?.ToString());
155+
if (print)
156+
Console.WriteLine(src?.ToString());
157+
156158
return src?.ToString() ?? "";
157159
}
158160

@@ -194,15 +196,17 @@ var useNewLine2ReplaceConnectionString
194196

195197
if (useNewLine2ReplaceConnectionString)
196198
{
197-
Console.WriteLine(result);
199+
if (print)
200+
Console.WriteLine(result);
198201

199202
return result;
200203
}
201204

202205
if (cutEnding)
203206
result = result[..(sb.Length - connection?.Length ?? 0)];
204207

205-
Console.WriteLine(result);
208+
if (print)
209+
Console.WriteLine(result);
206210

207211
return result;
208212
}

0 commit comments

Comments
 (0)