Skip to content

Commit 6baa5ec

Browse files
authored
Use Array.Empty where appropriate (#662)
+semver:patch
1 parent 47397ed commit 6baa5ec

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

src/FluentNHibernate.Testing/DomainModel/Mapping/PropertyPartTester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ public void NullSafeSet(DbCommand cmd, object value, int index, ISessionImplemen
565565

566566
public SqlType[] SqlTypes
567567
{
568-
get { return new SqlType[] {}; }
568+
get { return Array.Empty<SqlType>(); }
569569
}
570570
public Type ReturnedType => null;
571571

src/FluentNHibernate.Testing/FluentInterfaceTests/CustomPersister.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ public IType GetPropertyType(string propertyName)
3434

3535
public int[] FindDirty(object[] currentState, object[] previousState, object entity, ISessionImplementor session)
3636
{
37-
return new int[] {};
37+
return Array.Empty<int>();
3838
}
3939

4040
public int[] FindModified(object[] old, object[] current, object entity, ISessionImplementor session)
4141
{
42-
return new int[] {};
42+
return Array.Empty<int>();
4343
}
4444

4545
public object[] GetNaturalIdentifierSnapshot(object id, ISessionImplementor session)
4646
{
47-
return new object[] {};
47+
return Array.Empty<object>();
4848
}
4949

5050
public object Load(object id, object optionalObject, LockMode lockMode, ISessionImplementor session)
@@ -71,7 +71,7 @@ public void Update(object id, object[] fields, int[] dirtyFields, bool hasDirtyC
7171

7272
public object[] GetDatabaseSnapshot(object id, ISessionImplementor session)
7373
{
74-
return new object[] {};
74+
return Array.Empty<object>();
7575
}
7676

7777
public object GetCurrentVersion(object id, ISessionImplementor session)
@@ -112,7 +112,7 @@ public object CreateProxy(object id, ISessionImplementor session)
112112

113113
public object[] GetPropertyValuesToInsert(object obj, IDictionary mergeMap, ISessionImplementor session)
114114
{
115-
return new object[] {};
115+
return Array.Empty<object>();
116116
}
117117

118118
public void ProcessInsertGeneratedProperties(object id, object entity, object[] state, ISessionImplementor session)
@@ -149,7 +149,7 @@ public void SetPropertyValue(object obj, int i, object value, EntityMode entityM
149149

150150
public object[] GetPropertyValues(object obj, EntityMode entityMode)
151151
{
152-
return new object[] {};
152+
return Array.Empty<object>();
153153
}
154154

155155
public object GetPropertyValue(object obj, int i, EntityMode entityMode)
@@ -353,11 +353,11 @@ public IEntityPersister GetSubclassEntityPersister(object instance, ISessionFact
353353

354354
public string[] PropertySpaces
355355
{
356-
get { return new string[] {}; }
356+
get { return Array.Empty<string>(); }
357357
}
358358
public string[] QuerySpaces
359359
{
360-
get { return new string[] {}; }
360+
get { return Array.Empty<string>(); }
361361
}
362362
public bool IsMutable => false;
363363

@@ -373,49 +373,49 @@ public string[] QuerySpaces
373373

374374
public int[] NaturalIdentifierProperties
375375
{
376-
get { return new int[] {}; }
376+
get { return Array.Empty<int>(); }
377377
}
378378
public IIdentifierGenerator IdentifierGenerator => null;
379379

380380
public IType[] PropertyTypes
381381
{
382-
get { return new IType[] {}; }
382+
get { return Array.Empty<IType>(); }
383383
}
384384
public string[] PropertyNames
385385
{
386-
get { return new string[] {}; }
386+
get { return Array.Empty<string>(); }
387387
}
388388
public bool[] PropertyInsertability
389389
{
390-
get { return new bool[] {}; }
390+
get { return Array.Empty<bool>(); }
391391
}
392392
public ValueInclusion[] PropertyInsertGenerationInclusions
393393
{
394-
get { return new ValueInclusion[] {}; }
394+
get { return Array.Empty<ValueInclusion>(); }
395395
}
396396
public ValueInclusion[] PropertyUpdateGenerationInclusions
397397
{
398-
get { return new ValueInclusion[] {}; }
398+
get { return Array.Empty<ValueInclusion>(); }
399399
}
400400
public bool[] PropertyCheckability
401401
{
402-
get { return new bool[] {}; }
402+
get { return Array.Empty<bool>(); }
403403
}
404404
public bool[] PropertyNullability
405405
{
406-
get { return new bool[] {}; }
406+
get { return Array.Empty<bool>(); }
407407
}
408408
public bool[] PropertyVersionability
409409
{
410-
get { return new bool[] {}; }
410+
get { return Array.Empty<bool>(); }
411411
}
412412
public bool[] PropertyLaziness
413413
{
414-
get { return new bool[] {}; }
414+
get { return Array.Empty<bool>(); }
415415
}
416416
public CascadeStyle[] PropertyCascadeStyles
417417
{
418-
get { return new CascadeStyle[] {}; }
418+
get { return Array.Empty<CascadeStyle>(); }
419419
}
420420
public IType IdentifierType => null;
421421

@@ -457,7 +457,7 @@ public CascadeStyle[] PropertyCascadeStyles
457457

458458
public bool[] PropertyUpdateability
459459
{
460-
get { return new bool[] {}; }
460+
get { return Array.Empty<bool>(); }
461461
}
462462
public bool HasCache => false;
463463

src/FluentNHibernate/Conventions/DefaultConventionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private object Instantiate(Type type)
150150
if (IsFinderConstructor(constructor))
151151
instance = constructor.Invoke(new[] { this });
152152
else if (IsParameterlessConstructor(constructor))
153-
instance = constructor.Invoke(new object[] { });
153+
instance = constructor.Invoke(Array.Empty<object>());
154154
}
155155

156156
return instance;

0 commit comments

Comments
 (0)