@@ -1251,38 +1251,38 @@ private IEnumerable<CodeAttributeDeclaration> GetAttributes(bool isArray, TypeMo
1251
1251
attributes . Add ( arrayAttribute ) ;
1252
1252
}
1253
1253
1254
- foreach ( var attribute in attributes )
1254
+ foreach ( var args in attributes . Select ( a => a . Arguments ) )
1255
1255
{
1256
- bool namespacePrecalculated = attribute . Arguments . OfType < CodeAttributeArgument > ( ) . Any ( a => a . Name == "Namespace" ) ;
1256
+ bool namespacePrecalculated = args . OfType < CodeAttributeArgument > ( ) . Any ( a => a . Name == "Namespace" ) ;
1257
1257
if ( ! namespacePrecalculated )
1258
1258
{
1259
1259
if ( XmlNamespace != null )
1260
1260
{
1261
- attribute . Arguments . Add ( new CodeAttributeArgument ( "Namespace" , new CodePrimitiveExpression ( XmlNamespace ) ) ) ;
1261
+ args . Add ( new CodeAttributeArgument ( "Namespace" , new CodePrimitiveExpression ( XmlNamespace ) ) ) ;
1262
1262
}
1263
1263
1264
1264
if ( Form == XmlSchemaForm . Qualified && IsAttribute )
1265
1265
{
1266
1266
if ( XmlNamespace == null )
1267
1267
{
1268
- attribute . Arguments . Add ( new CodeAttributeArgument ( "Namespace" , new CodePrimitiveExpression ( OwningType . XmlSchemaName . Namespace ) ) ) ;
1268
+ args . Add ( new CodeAttributeArgument ( "Namespace" , new CodePrimitiveExpression ( OwningType . XmlSchemaName . Namespace ) ) ) ;
1269
1269
}
1270
1270
1271
- attribute . Arguments . Add ( new CodeAttributeArgument ( "Form" ,
1271
+ args . Add ( new CodeAttributeArgument ( "Form" ,
1272
1272
new CodeFieldReferenceExpression ( new CodeTypeReferenceExpression ( CodeUtilities . CreateTypeReference ( typeof ( XmlSchemaForm ) , Configuration ) ) ,
1273
1273
"Qualified" ) ) ) ;
1274
1274
}
1275
1275
else if ( ( Form == XmlSchemaForm . Unqualified || Form == XmlSchemaForm . None ) && ! IsAttribute && ! IsAny && XmlNamespace == null )
1276
1276
{
1277
- attribute . Arguments . Add ( new CodeAttributeArgument ( "Form" ,
1277
+ args . Add ( new CodeAttributeArgument ( "Form" ,
1278
1278
new CodeFieldReferenceExpression ( new CodeTypeReferenceExpression ( CodeUtilities . CreateTypeReference ( typeof ( XmlSchemaForm ) , Configuration ) ) ,
1279
1279
"Unqualified" ) ) ) ;
1280
1280
}
1281
1281
}
1282
1282
1283
1283
if ( IsNillable && ! ( IsCollection && Type is SimpleModel m && m . ValueType . IsValueType ) && ! ( IsNullable && Configuration . DoNotForceIsNullable ) )
1284
1284
{
1285
- attribute . Arguments . Add ( new CodeAttributeArgument ( "IsNullable" , new CodePrimitiveExpression ( true ) ) ) ;
1285
+ args . Add ( new CodeAttributeArgument ( "IsNullable" , new CodePrimitiveExpression ( true ) ) ) ;
1286
1286
}
1287
1287
1288
1288
if ( Type is SimpleModel simpleModel && simpleModel . UseDataTypeAttribute )
@@ -1295,7 +1295,7 @@ private IEnumerable<CodeAttributeDeclaration> GetAttributes(bool isArray, TypeMo
1295
1295
if ( name . Namespace == XmlSchema . Namespace && name . Name != "anySimpleType" )
1296
1296
{
1297
1297
var dataType = new CodeAttributeArgument ( "DataType" , new CodePrimitiveExpression ( name . Name ) ) ;
1298
- attribute . Arguments . Add ( dataType ) ;
1298
+ args . Add ( dataType ) ;
1299
1299
break ;
1300
1300
}
1301
1301
else
0 commit comments