Skip to content

Commit c95f131

Browse files
committed
Implement VS suggestions
1 parent 22da919 commit c95f131

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

XmlSchemaClassGenerator.Tests/Compiler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public static Assembly GetAssembly(string name)
6060

6161
public static Assembly Generate(string name, string pattern, Generator generatorPrototype = null)
6262
{
63-
if (Assemblies.ContainsKey(name)) { return Assemblies[name]; }
63+
if (Assemblies.TryGetValue(name, out Assembly value)) { return value; }
6464

6565
var files = Glob.ExpandNames(pattern).OrderByDescending(f => f);
6666

@@ -69,7 +69,7 @@ public static Assembly Generate(string name, string pattern, Generator generator
6969

7070
public static Assembly GenerateFiles(string name, IEnumerable<string> files, Generator generatorPrototype = null)
7171
{
72-
if (Assemblies.ContainsKey(name)) { return Assemblies[name]; }
72+
if (Assemblies.TryGetValue(name, out Assembly value)) { return value; }
7373

7474
generatorPrototype ??= new Generator
7575
{

XmlSchemaClassGenerator.Tests/XmlTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3219,7 +3219,7 @@ public void TestOmitXmlIncludeAttributeSerializationWithExtraTypes()
32193219
Assert.Empty(xmlIncludeAttributes);
32203220

32213221
// Test serialization with extraTypes parameter for DerivedType1
3222-
var serializer1 = new XmlSerializer(containerType, new[] { derivedType1, derivedType2 });
3222+
var serializer1 = new XmlSerializer(containerType, [derivedType1, derivedType2]);
32233223

32243224
// Create an instance with DerivedType1
32253225
var container1 = Activator.CreateInstance(containerType);
@@ -3256,7 +3256,7 @@ public void TestOmitXmlIncludeAttributeSerializationWithExtraTypes()
32563256
Assert.Equal("Derived Value 1", derivedProperty1Prop.GetValue(deserializedItem1));
32573257

32583258
// Test serialization with DerivedType2
3259-
var serializer2 = new XmlSerializer(containerType, new[] { derivedType1, derivedType2 });
3259+
var serializer2 = new XmlSerializer(containerType, [derivedType1, derivedType2]);
32603260

32613261
var container2 = Activator.CreateInstance(containerType);
32623262
var derived2 = Activator.CreateInstance(derivedType2);

0 commit comments

Comments
 (0)