@@ -188,12 +188,7 @@ private static Uuid CreateTimeBasedCore(DateTime timestamp, int clock, Node node
188188 }
189189
190190 public static Uuid CreateNameBasedMD5 ( Uri url )
191- {
192- if ( url == null )
193- throw new ArgumentNullException ( nameof ( url ) ) ;
194-
195- return CreateNameBasedMD5 ( url . ToString ( ) , Namespace . RFC4122Url ) ;
196- }
191+ => CreateNameBasedMD5 ( ( url ?? throw new ArgumentNullException ( nameof ( url ) ) ) . ToString ( ) , Namespace . RFC4122Url ) ;
197192
198193 public static Uuid CreateNameBasedMD5 ( string name , Namespace ns )
199194 => CreateNameBasedMD5 ( Encoding . ASCII . GetBytes ( name ) , ns ) ;
@@ -202,12 +197,7 @@ public static Uuid CreateNameBasedMD5(byte[] name, Namespace ns)
202197 => CreateNameBased ( name , ns , UuidVersion . NameBasedMD5Hash ) ;
203198
204199 public static Uuid CreateNameBasedSHA1 ( Uri url )
205- {
206- if ( url == null )
207- throw new ArgumentNullException ( nameof ( url ) ) ;
208-
209- return CreateNameBasedSHA1 ( url . ToString ( ) , Namespace . RFC4122Url ) ;
210- }
200+ => CreateNameBasedSHA1 ( ( url ?? throw new ArgumentNullException ( nameof ( url ) ) ) . ToString ( ) , Namespace . RFC4122Url ) ;
211201
212202 public static Uuid CreateNameBasedSHA1 ( string name , Namespace ns )
213203 => CreateNameBasedSHA1 ( Encoding . ASCII . GetBytes ( name ) , ns ) ;
@@ -216,26 +206,19 @@ public static Uuid CreateNameBasedSHA1(byte[] name, Namespace ns)
216206 => CreateNameBased ( name , ns , UuidVersion . NameBasedSHA1Hash ) ;
217207
218208 public static Uuid CreateNameBased ( Uri url , UuidVersion version )
219- {
220- if ( url == null )
221- throw new ArgumentNullException ( nameof ( url ) ) ;
222-
223- return CreateNameBased ( url . ToString ( ) , Namespace . RFC4122Url , version ) ;
224- }
209+ => CreateNameBased ( ( url ?? throw new ArgumentNullException ( nameof ( url ) ) ) . ToString ( ) , Namespace . RFC4122Url , version ) ;
225210
226211 public static Uuid CreateNameBased ( string name , Namespace ns , UuidVersion version )
227212 => CreateNameBased ( Encoding . ASCII . GetBytes ( name ) , ns , version ) ;
228213
229214 public static Uuid CreateNameBased ( byte [ ] name , Namespace ns , UuidVersion version )
230- {
231- return ns switch {
215+ => ns switch {
232216 Namespace . RFC4122Dns => CreateNameBased ( name , RFC4122NamespaceDns , version ) ,
233217 Namespace . RFC4122Url => CreateNameBased ( name , RFC4122NamespaceUrl , version ) ,
234218 Namespace . RFC4122IsoOid => CreateNameBased ( name , RFC4122NamespaceIsoOid , version ) ,
235219 Namespace . RFC4122X500 => CreateNameBased ( name , RFC4122NamespaceX500 , version ) ,
236220 _ => throw ExceptionUtils . CreateArgumentMustBeValidEnumValue ( nameof ( ns ) , ns ) ,
237221 } ;
238- }
239222
240223 public static Uuid CreateNameBased ( string name , Uuid namespaceId , UuidVersion version )
241224 => CreateNameBased ( Encoding . ASCII . GetBytes ( name ) , namespaceId , version ) ;
0 commit comments