This repository was archived by the owner on Jan 25, 2026. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1+ using System ;
12using System . Collections . Generic ;
23using System . Text ;
34
@@ -9,7 +10,7 @@ namespace PCL.Core.Utils;
910
1011public class ArgumentsBuilder
1112{
12- private readonly Dictionary < string , string > _args = new ( ) ;
13+ private readonly Dictionary < string , string ? > _args = new ( ) ;
1314
1415 /// <summary>
1516 /// 添加键值对参数(自动处理空格转义)
@@ -18,6 +19,8 @@ public class ArgumentsBuilder
1819 /// <param name="value">参数值</param>
1920 public ArgumentsBuilder Add ( string key , string value )
2021 {
22+ if ( key is null ) throw new NullReferenceException ( nameof ( key ) ) ;
23+ if ( value is null ) throw new NullReferenceException ( nameof ( value ) ) ;
2124 _args [ key ] = _handleEscapeValue ( value ) ;
2225 return this ;
2326 }
@@ -28,6 +31,7 @@ public ArgumentsBuilder Add(string key, string value)
2831 /// <param name="flag">标志名(不带前缀)</param>
2932 public ArgumentsBuilder AddFlag ( string flag )
3033 {
34+ if ( flag is null ) throw new NullReferenceException ( nameof ( flag ) ) ;
3135 _args [ flag ] = null ;
3236 return this ;
3337 }
@@ -77,7 +81,7 @@ public string Build(int prefixStyle = 0)
7781 }
7882
7983 // 添加值(如果有)
80- if ( arg . Value != null )
84+ if ( arg . Value is not null )
8185 {
8286 sb . Append ( '=' ) . Append ( arg . Value ) ;
8387 }
You can’t perform that action at this time.
0 commit comments