From d2c854dba7aeade03b2158bb78ef72e9e9725705 Mon Sep 17 00:00:00 2001 From: Michael Ganss Date: Fri, 29 Jan 2021 16:07:00 +0100 Subject: [PATCH] Use Array.Empty() instead of new Array[0] (fixes #250) --- XmlSchemaClassGenerator/TypeModel.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/XmlSchemaClassGenerator/TypeModel.cs b/XmlSchemaClassGenerator/TypeModel.cs index a46d918d..19b77c11 100644 --- a/XmlSchemaClassGenerator/TypeModel.cs +++ b/XmlSchemaClassGenerator/TypeModel.cs @@ -1115,7 +1115,8 @@ public void AddMembersTo(CodeTypeDeclaration typeDeclaration, bool withDataBindi if (collectionType == typeof(System.Array)) { var initTypeReference = propertyType.GetReferenceFor(OwningType.Namespace, collection: false, forInit: true, attribute: IsAttribute); - initExpression = new CodeArrayCreateExpression(initTypeReference); + var arrayReference = CodeUtilities.CreateTypeReference(typeof(System.Array), Configuration); + initExpression = new CodeMethodInvokeExpression(new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(arrayReference), "Empty", initTypeReference)); } else {