@@ -99,7 +99,7 @@ public static string GetString(XmlNode n0, string path)
9999 string s = GetString ( n0 , path , null ) ;
100100 if ( s == null )
101101 {
102- throw new Exception ( "Missing spec XML node: " + path ) ;
102+ throw new Exception ( $ "Missing spec XML node: { path } " ) ;
103103 }
104104 return s ;
105105 }
@@ -248,7 +248,7 @@ public void HandleOption(string opt)
248248 }
249249 else
250250 {
251- Console . Error . WriteLine ( "Unsupported command-line option: " + opt ) ;
251+ Console . Error . WriteLine ( $ "Unsupported command-line option: { opt } " ) ;
252252 Usage ( ) ;
253253 }
254254 }
@@ -294,7 +294,7 @@ public void Generate()
294294
295295 public void LoadSpec ( )
296296 {
297- Console . WriteLine ( "* Loading spec from '" + m_inputXmlFilename + " '") ;
297+ Console . WriteLine ( $ "* Loading spec from '{ m_inputXmlFilename } '") ;
298298 m_spec = new XmlDocument ( ) ;
299299
300300 using ( var stream = new FileStream ( m_inputXmlFilename , FileMode . Open , FileAccess . Read ) )
@@ -358,12 +358,12 @@ public string MapDomain(string d)
358358
359359 public string VersionToken ( )
360360 {
361- return "v" + m_majorVersion + "_" + m_minorVersion ;
361+ return $ "v { m_majorVersion } _ { m_minorVersion } " ;
362362 }
363363
364364 public void GenerateOutput ( )
365365 {
366- Console . WriteLine ( "* Generating code into '" + m_outputFilename + " '") ;
366+ Console . WriteLine ( $ "* Generating code into '{ m_outputFilename } '") ;
367367
368368 string directory = Path . GetDirectoryName ( m_outputFilename ) ;
369369
@@ -1069,11 +1069,11 @@ public void EmitContentHeaderFactory(MethodInfo method)
10691069 EmitLine ( " {" ) ;
10701070 if ( Attribute ( method , typeof ( AmqpUnsupportedAttribute ) ) != null )
10711071 {
1072- EmitLine ( string . Format ( " throw new UnsupportedMethodException(\" " + method . Name + " \" );") ) ;
1072+ EmitLine ( $ " throw new UnsupportedMethodException(\" { method . Name } \" );") ;
10731073 }
10741074 else
10751075 {
1076- EmitLine ( " return new " + MangleClass ( contentClass ) + " Properties();") ;
1076+ EmitLine ( $ " return new { MangleClass ( contentClass ) } Properties();") ;
10771077 }
10781078 EmitLine ( " }" ) ;
10791079 }
@@ -1101,7 +1101,7 @@ public void MaybeEmitModelMethod(MethodInfo method)
11011101 {
11021102 EmitModelMethodPreamble ( method ) ;
11031103 EmitLine ( " {" ) ;
1104- EmitLine ( " throw new UnsupportedMethodException(\" " + method . Name + " \" );") ;
1104+ EmitLine ( $ " throw new UnsupportedMethodException(\" { method . Name } \" );") ;
11051105 EmitLine ( " }" ) ;
11061106 }
11071107 else
@@ -1198,7 +1198,7 @@ public void LookupAmqpMethod(MethodInfo method,
11981198
11991199 if ( amqpClass == null || amqpMethod == null )
12001200 {
1201- throw new Exception ( "Could not find AMQP class or method for IModel method " + method . Name ) ;
1201+ throw new Exception ( $ "Could not find AMQP class or method for IModel method { method . Name } " ) ;
12021202 }
12031203 }
12041204
@@ -1227,7 +1227,7 @@ public void EmitModelMethod(MethodInfo method)
12271227 : replyMapping . m_methodName ) ;
12281228 if ( amqpReplyMethod == null )
12291229 {
1230- throw new Exception ( "Could not find AMQP reply method for IModel method " + method . Name ) ;
1230+ throw new Exception ( $ "Could not find AMQP reply method for IModel method { method . Name } " ) ;
12311231 }
12321232 }
12331233
@@ -1269,7 +1269,7 @@ public void EmitModelMethod(MethodInfo method)
12691269 string contentHeaderExpr =
12701270 contentHeaderParameter == null
12711271 ? "null"
1272- : " (" + MangleClass ( amqpClass . Name ) + " Properties) " + contentHeaderParameter . Name ;
1272+ : $ " ({ MangleClass ( amqpClass . Name ) } Properties) { contentHeaderParameter . Name } " ;
12731273 string contentBodyExpr =
12741274 contentBodyParameter == null ? "null" : contentBodyParameter . Name ;
12751275
@@ -1316,15 +1316,15 @@ public void EmitModelMethod(MethodInfo method)
13161316
13171317 if ( nowaitParameter != null )
13181318 {
1319- EmitLine ( " if (" + nowaitParameter . Name + ") {") ;
1320- EmitLine ( " ModelSend(__req," + contentHeaderExpr + "," + contentBodyExpr + " );") ;
1319+ EmitLine ( $ " if ({ nowaitParameter . Name } ) { {") ;
1320+ EmitLine ( $ " ModelSend(__req,{ contentHeaderExpr } , { contentBodyExpr } );") ;
13211321 if ( method . ReturnType == typeof ( void ) )
13221322 {
13231323 EmitLine ( " return;" ) ;
13241324 }
13251325 else
13261326 {
1327- EmitLine ( " return " + nowaitExpression + " ;") ;
1327+ EmitLine ( $ " return { nowaitExpression } ;") ;
13281328 }
13291329 EmitLine ( " }" ) ;
13301330 }
@@ -1334,7 +1334,7 @@ public void EmitModelMethod(MethodInfo method)
13341334
13351335 if ( amqpReplyMethod == null )
13361336 {
1337- EmitLine ( " ModelSend(__req," + contentHeaderExpr + "," + contentBodyExpr + " );") ;
1337+ EmitLine ( $ " ModelSend(__req,{ contentHeaderExpr } , { contentBodyExpr } );") ;
13381338 }
13391339 else
13401340 {
@@ -1358,24 +1358,24 @@ public void EmitModelMethod(MethodInfo method)
13581358 string fieldPrefix = IsAmqpClass ( method . ReturnType ) ? "_" : "" ;
13591359
13601360 // No field mapping --> it's assumed to be a struct to fill in.
1361- EmitLine ( " " + method . ReturnType + " __result = new " + method . ReturnType + " ();") ;
1361+ EmitLine ( $ " { method . ReturnType } __result = new { method . ReturnType } ();") ;
13621362 foreach ( FieldInfo fi in method . ReturnType . GetFields ( ) )
13631363 {
13641364 if ( Attribute ( fi , typeof ( AmqpFieldMappingAttribute ) ) is AmqpFieldMappingAttribute returnFieldMapping )
13651365 {
1366- EmitLine ( " __result." + fi . Name + " = __rep." + fieldPrefix + returnFieldMapping . m_fieldName + " ;") ;
1366+ EmitLine ( $ " __result.{ fi . Name } = __rep.{ fieldPrefix } { returnFieldMapping . m_fieldName } ;") ;
13671367 }
13681368 else
13691369 {
1370- EmitLine ( " __result." + fi . Name + " = __rep." + fieldPrefix + fi . Name + " ;") ;
1370+ EmitLine ( $ " __result.{ fi . Name } = __rep.{ fieldPrefix } { fi . Name } ;") ;
13711371 }
13721372 }
13731373 EmitLine ( " return __result;" ) ;
13741374 }
13751375 else
13761376 {
13771377 // Field mapping --> return just the field we're interested in.
1378- EmitLine ( " return __rep._" + returnMapping . m_fieldName + " ;") ;
1378+ EmitLine ( $ " return __rep._{ returnMapping . m_fieldName } ;") ;
13791379 }
13801380 }
13811381 }
0 commit comments