From f4699819eb6a15585680d7426f1865e26be9270f Mon Sep 17 00:00:00 2001 From: adamjstone <8525409+adamjstone@users.noreply.github.com> Date: Tue, 1 Dec 2020 01:55:18 -0600 Subject: [PATCH] #371 Standardize use of "new" expression. --- .../Models/User/DomainModel.Named.cs | 6 +-- .../Models/UserRole/DomainModel.Named.cs | 6 +-- .../UserRoleAssignment/DomainModel.Named.cs | 6 +-- .../InfiniteSequence.cs | 4 +- .../ReadOnlyPinnedMemory.cs | 4 +- .../TreeNode.cs | 2 +- .../Extensions/ICommandRegisterExtensions.cs | 10 ++--- .../ArgumentValidation/ObjectExtensions.cs | 4 +- .../ArgumentValidation/ValidationResult.cs | 2 +- .../ArgumentValidation/ValidationTarget.cs | 2 +- .../Caching/DistributedCacheClient.cs | 4 +- .../Caching/InMemoryCacheClient.cs | 6 +-- .../Concurrency/ConcurrencyControl.cs | 8 ++-- .../Concurrency/ConcurrencyControlToken.cs | 2 +- .../Concurrency/SemaphoreControl.cs | 2 +- .../ConfigurableInstrument.cs | 4 +- .../DateTimeRange.cs | 24 ++++++------ .../Extensions/ByteCollectionExtensions.cs | 2 +- .../Extensions/ByteExtensions.cs | 2 +- .../Extensions/CharacterExtensions.cs | 2 +- .../Extensions/DateTimeExtensions.cs | 38 +++++++++---------- .../Extensions/EnumExtensions.cs | 2 +- .../Extensions/ObjectExtensions.cs | 8 ++-- .../Extensions/UriExtensions.cs | 4 +- .../Instrument.cs | 8 ++-- src/RapidField.SolidInstruments.Core/Nix.cs | 2 +- .../ReferenceManager.cs | 4 +- .../SemanticVersion.cs | 16 ++++---- .../TimeOfDay.cs | 10 ++--- .../TimeStamp.cs | 4 +- .../Asymmetric/AsymmetricKeyPair.cs | 6 +-- .../DigitalSignaturePublicKey.cs | 4 +- .../DigitalSignature/Ecdsa/EcdsaKeyPair.cs | 4 +- .../KeyExchange/Ecdh/EcdhKeyPair.cs | 4 +- .../KeyExchange/KeyExchangePublicKey.cs | 4 +- .../CryptographicKey.cs | 8 ++-- .../RandomNumberGeneratorExtensions.cs | 14 +++---- .../HardenedRandomNumberGenerator.cs | 14 +++---- .../Hashing/Argon2/Argon2HashAlgorithm.cs | 2 +- .../Hashing/HashAlgorithmBase.cs | 2 +- .../Secrets/CascadingSymmetricKeySecret.cs | 2 +- .../Secrets/GuidSecret.cs | 2 +- .../PasswordCompositionRequirements.cs | 8 ++-- .../Secrets/Secret.cs | 2 +- .../Secrets/SecretStorePersistenceVehicle.cs | 6 +-- .../Secrets/SecretVault.cs | 2 +- .../Secrets/SymmetricKeySecret.cs | 2 +- .../Secrets/X509CertificateSecret.cs | 2 +- .../SecureMemory.cs | 6 +-- .../Symmetric/CascadingSymmetricKey.cs | 12 +++--- .../Symmetric/EncryptedModel.cs | 2 +- .../Symmetric/SymmetricKey.cs | 4 +- .../Symmetric/SymmetricKeyCipher.cs | 8 ++-- .../Extensions/IEventRegisterExtensions.cs | 16 ++++---- .../DependencyContainer.cs | 6 +-- .../DependencyContainerConfiguration.cs | 2 +- .../DependencyEngine.cs | 8 ++-- .../DependencyScope.cs | 2 +- .../IServiceCollectionExtensions.cs | 2 +- .../ServiceScope.cs | 2 +- .../Physics/Area.cs | 32 ++++++++-------- .../Physics/GeographicCoordinates.cs | 6 +-- .../Physics/Length.cs | 32 ++++++++-------- .../Physics/Mass.cs | 24 ++++++------ .../Physics/Temperature.cs | 16 ++++---- .../Physics/Volume.cs | 34 ++++++++--------- .../Extensions/IEnumerableExtensions.cs | 10 ++--- .../AzureServiceBusClientFactory.cs | 8 ++-- .../AzureServiceBusListeningFacade.cs | 2 +- .../AzureServiceBusMessageAdapter.cs | 2 +- .../InMemoryMessageAdapter.cs | 2 +- .../RabbitMqMessageAdapter.cs | 2 +- .../RabbitMqMessageTransport.cs | 2 +- .../ICommandMessageRegisterExtensions.cs | 4 +- .../IRequestMessageRegisterExtensions.cs | 2 +- .../MessageListeningFacade.cs | 8 ++-- .../MessageListeningFailurePolicy.cs | 2 +- .../MessageListeningRetryPolicy.cs | 4 +- .../MessageRequestingFacade.cs | 4 +- .../MessagingClientFactory.cs | 4 +- .../MessagingEntityPath.cs | 2 +- .../MessagingFacade.cs | 4 +- .../Service/MessageListeningProfile.cs | 2 +- .../Service/MessagingServiceExecutor.cs | 6 +-- .../Service/PingRequestMessageListener.cs | 2 +- .../TransportPrimitives/MessageQueue.cs | 4 +- .../TransportPrimitives/MessageTopic.cs | 2 +- .../TransportPrimitives/MessageTransport.cs | 10 ++--- .../MessageTransportConnection.cs | 4 +- .../MessagingEntityClient.cs | 6 +-- .../FactoryProducedInstanceGroup.cs | 2 +- .../ObjectContainer.cs | 6 +-- ...ObjectContainerConfigurationDefinitions.cs | 2 +- .../ObjectFactory.cs | 2 +- ...FactoryConfigurationProductionFunctions.cs | 2 +- .../SelfComposingInstrument.cs | 6 +-- .../DynamicSerializer.cs | 10 ++--- .../ServiceExecutor.cs | 6 +-- .../Base32Encoding.cs | 4 +- .../EnhancedReadabilityGuid.cs | 14 +++---- .../Extensions/GuidExtensions.cs | 2 +- .../HexadecimalEncoding.cs | 2 +- .../WebExecutor.cs | 2 +- .../SimulatedAutofacDependencyPackage.cs | 2 +- .../SimulatedInstrument.cs | 2 +- .../SimulatedModel.cs | 2 +- .../Extensions/IListExtensionsTests.cs | 6 +-- .../RandomNumberGeneratorExtensionsTests.cs | 2 +- .../SimulatedModel.cs | 2 +- .../Entities/NumberSeries.cs | 2 +- .../Extensions/INumberExtensions.cs | 2 +- .../Extensions/INumberSeriesExtensions.cs | 2 +- .../INumberSeriesNumberExtensions.cs | 2 +- .../SimulatedAutofacDependencyPackage.cs | 2 +- .../SimulatedDatabaseModelDependencyModule.cs | 2 +- .../SimulatedBarDataStore.cs | 5 +-- .../SimulatedFooDataStore.cs | 2 +- .../SimulatedAutofacDependencyPackage.cs | 2 +- .../SimulatedDotNetNativeDependencyPackage.cs | 2 +- .../SimulatedSourceConfigurator.cs | 2 +- .../RequestResponse/Ping/RequestListener.cs | 2 +- .../Models/Customer/DomainModel.cs | 6 +-- .../Models/Product/DomainModel.cs | 6 +-- .../SimulatedDependencyPackage.cs | 2 +- .../SimulatedServiceState.cs | 6 +-- 125 files changed, 359 insertions(+), 362 deletions(-) diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.Named.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.Named.cs index 7808a817..dab7754f 100644 --- a/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.Named.cs +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/User/DomainModel.Named.cs @@ -40,7 +40,7 @@ public static class Named /// /// A collection of all known instances. /// - public static IEnumerable All() => new DomainModel[] + public static IEnumerable All() => new[] { StevenCallahan, TomSmith @@ -71,7 +71,7 @@ private static String GetPasswordHash(String plaintextPassword) /// /// Gets the Steven Callahan user. /// - public static DomainModel StevenCallahan => new DomainModel(Guid.Parse("a04fc5b0-1a67-43ff-89af-750128398d8a")) + public static DomainModel StevenCallahan => new(Guid.Parse("a04fc5b0-1a67-43ff-89af-750128398d8a")) { EmailAddress = "steven.callahan@example.com", Name = nameof(StevenCallahan), @@ -81,7 +81,7 @@ private static String GetPasswordHash(String plaintextPassword) /// /// Gets the Tom Smith user. /// - public static DomainModel TomSmith => new DomainModel(Guid.Parse("3d46470a-1c90-4e94-bc5c-3cbde44ba6ac")) + public static DomainModel TomSmith => new(Guid.Parse("3d46470a-1c90-4e94-bc5c-3cbde44ba6ac")) { EmailAddress = "tom.smith@example.com", Name = nameof(TomSmith), diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/DomainModel.Named.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/DomainModel.Named.cs index b43e8f29..17bb8dac 100644 --- a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/DomainModel.Named.cs +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRole/DomainModel.Named.cs @@ -37,7 +37,7 @@ public static class Named /// /// A collection of all known instances. /// - public static IEnumerable All() => new DomainModel[] + public static IEnumerable All() => new[] { EndUser, SystemAdministrator @@ -46,7 +46,7 @@ public static class Named /// /// Gets the end user role. /// - public static DomainModel EndUser => new DomainModel(Guid.Parse("816e7126-2034-49b3-af08-d07cab150d93")) + public static DomainModel EndUser => new(Guid.Parse("816e7126-2034-49b3-af08-d07cab150d93")) { Description = "A standard end user.", Name = nameof(EndUser) @@ -55,7 +55,7 @@ public static class Named /// /// Gets the system administrator user role. /// - public static DomainModel SystemAdministrator => new DomainModel(Guid.Parse("b13c7a39-0c65-4515-a4af-2e3f60d289ba")) + public static DomainModel SystemAdministrator => new(Guid.Parse("b13c7a39-0c65-4515-a4af-2e3f60d289ba")) { Description = "A user with full administrative privileges.", Name = nameof(SystemAdministrator) diff --git a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/DomainModel.Named.cs b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/DomainModel.Named.cs index b354a0d6..3d67bc99 100644 --- a/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/DomainModel.Named.cs +++ b/example/RapidField.SolidInstruments.Example.Domain/Models/UserRoleAssignment/DomainModel.Named.cs @@ -39,7 +39,7 @@ public static class Named /// /// A collection of all known instances. /// - public static IEnumerable All() => new DomainModel[] + public static IEnumerable All() => new[] { StevenCallahanSystemAdministrator, TomSmithEndUser @@ -48,7 +48,7 @@ public static class Named /// /// Gets the system administrator role assignment for Steven Callahan. /// - public static DomainModel StevenCallahanSystemAdministrator => new DomainModel(Guid.Parse("3af59674-efe9-46ad-b8b3-847e1a74c53c")) + public static DomainModel StevenCallahanSystemAdministrator => new(Guid.Parse("3af59674-efe9-46ad-b8b3-847e1a74c53c")) { User = UserModel.Named.StevenCallahan, UserRole = UserRoleModel.Named.SystemAdministrator @@ -57,7 +57,7 @@ public static class Named /// /// Gets the end user role assignment for Tom Smith. /// - public static DomainModel TomSmithEndUser => new DomainModel(Guid.Parse("472ceca5-e06b-4ae7-8022-ecb160822137")) + public static DomainModel TomSmithEndUser => new(Guid.Parse("472ceca5-e06b-4ae7-8022-ecb160822137")) { User = UserModel.Named.TomSmith, UserRole = UserRoleModel.Named.EndUser diff --git a/src/RapidField.SolidInstruments.Collections/InfiniteSequence.cs b/src/RapidField.SolidInstruments.Collections/InfiniteSequence.cs index 34e4b56f..c87ed36e 100644 --- a/src/RapidField.SolidInstruments.Collections/InfiniteSequence.cs +++ b/src/RapidField.SolidInstruments.Collections/InfiniteSequence.cs @@ -213,12 +213,12 @@ public T[] ToArray(Int32 startIndex, Int32 count) /// Represents an object that can be used to synchronize access to the current . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Object SyncRoot = new Object(); + private readonly Object SyncRoot = new(); /// /// Represents the ordered, calculated terms for the current . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private List CalculatedTerms = new List(); + private List CalculatedTerms = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs b/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs index 7fcb9a38..c0135818 100644 --- a/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs +++ b/src/RapidField.SolidInstruments.Collections/ReadOnlyPinnedMemory.cs @@ -103,7 +103,7 @@ public ReadOnlyPinnedMemory(T[] field) Handle = GCHandle.Alloc(field.RejectIf().IsNull(nameof(field)).TargetArgument, GCHandleType.Pinned); Field = (T[])Handle.Target; HandleIsActive = true; - LazyFieldMemory = new Lazy>(InitializeFieldMemory, LazyThreadSafetyMode.ExecutionAndPublication); + LazyFieldMemory = new(InitializeFieldMemory, LazyThreadSafetyMode.ExecutionAndPublication); Length = field.Length; Pointer = Handle.AddrOfPinnedObject(); } @@ -230,7 +230,7 @@ protected override void Dispose(Boolean disposing) /// Initializes the lazily-initialized structure collection as a . /// [DebuggerHidden] - private Memory InitializeFieldMemory() => new Memory(Field); + private Memory InitializeFieldMemory() => new(Field); /// /// Gets a value indicating whether or not the memory field is empty. diff --git a/src/RapidField.SolidInstruments.Collections/TreeNode.cs b/src/RapidField.SolidInstruments.Collections/TreeNode.cs index 01aa1489..359e8c9d 100644 --- a/src/RapidField.SolidInstruments.Collections/TreeNode.cs +++ b/src/RapidField.SolidInstruments.Collections/TreeNode.cs @@ -406,7 +406,7 @@ public T Value /// Represents an object that is used to synchronize access to the associated resource(s). /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Object SyncRoot = new Object(); + private readonly Object SyncRoot = new(); /// /// Represents the parent node of the current , or if the current diff --git a/src/RapidField.SolidInstruments.Command/Extensions/ICommandRegisterExtensions.cs b/src/RapidField.SolidInstruments.Command/Extensions/ICommandRegisterExtensions.cs index 7c33c204..b8b38141 100644 --- a/src/RapidField.SolidInstruments.Command/Extensions/ICommandRegisterExtensions.cs +++ b/src/RapidField.SolidInstruments.Command/Extensions/ICommandRegisterExtensions.cs @@ -29,7 +29,7 @@ public static class ICommandRegisterExtensions /// /// A new . /// - public static TextualCommand FromText(this ICommandRegister target, String value) => new TextualCommand(value); + public static TextualCommand FromText(this ICommandRegister target, String value) => new(value); /// /// Creates a new . @@ -49,7 +49,7 @@ public static class ICommandRegisterExtensions /// /// A new . /// - public static TextualCommand FromText(this ICommandRegister target, String value, IEnumerable labels) => new TextualCommand(value, labels); + public static TextualCommand FromText(this ICommandRegister target, String value, IEnumerable labels) => new(value, labels); /// /// Creates a new . @@ -69,7 +69,7 @@ public static class ICommandRegisterExtensions /// /// is . /// - public static GetConfigurationSectionCommand GetConfigurationSection(this ICommandRegister target, String key) => new GetConfigurationSectionCommand(key); + public static GetConfigurationSectionCommand GetConfigurationSection(this ICommandRegister target, String key) => new(key); /// /// Creates a new . @@ -89,7 +89,7 @@ public static class ICommandRegisterExtensions /// /// is . /// - public static GetConfigurationValueCommand GetConfigurationValue(this ICommandRegister target, String key) => new GetConfigurationValueCommand(key); + public static GetConfigurationValueCommand GetConfigurationValue(this ICommandRegister target, String key) => new(key); /// /// Creates a new . @@ -109,6 +109,6 @@ public static class ICommandRegisterExtensions /// /// is . /// - public static GetConnectionStringCommand GetConnectionString(this ICommandRegister target, String name) => new GetConnectionStringCommand(name); + public static GetConnectionStringCommand GetConnectionString(this ICommandRegister target, String name) => new(name); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ObjectExtensions.cs b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ObjectExtensions.cs index 4e7bded6..7406b868 100644 --- a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ObjectExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ObjectExtensions.cs @@ -29,7 +29,7 @@ public static class ObjectExtensions /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ValidationTarget RejectIf(this TArgument target) => new ValidationTarget(target); + public static ValidationTarget RejectIf(this TArgument target) => new(target); /// /// Raises a new if the target argument satisfies the specified predicate. @@ -114,7 +114,7 @@ public static ValidationResult RejectIf(this TArgument tar throw new ArgumentException(exceptionMessage, targetParameterName); } - return new ValidationResult(new ValidationTarget(target)); + return new(new(target)); } } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationResult.cs b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationResult.cs index 19fdb0dd..a32f77a9 100644 --- a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationResult.cs +++ b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationResult.cs @@ -111,7 +111,7 @@ public ValidationResult OrIf(Predicate predicate, String t throw new ArgumentException(exceptionMessage, targetParameterName); } - return new ValidationResult(Target); + return new(Target); } /// diff --git a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationTarget.cs b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationTarget.cs index 22773c0c..008a7841 100644 --- a/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationTarget.cs +++ b/src/RapidField.SolidInstruments.Core/ArgumentValidation/ValidationTarget.cs @@ -36,7 +36,7 @@ internal ValidationTarget(TArgument argument) /// Gets the result of the validation operation. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal ValidationResult Result => new ValidationResult(this); + internal ValidationResult Result => new(this); /// /// Represents the target argument. diff --git a/src/RapidField.SolidInstruments.Core/Caching/DistributedCacheClient.cs b/src/RapidField.SolidInstruments.Core/Caching/DistributedCacheClient.cs index 74c48b95..9caeac65 100644 --- a/src/RapidField.SolidInstruments.Core/Caching/DistributedCacheClient.cs +++ b/src/RapidField.SolidInstruments.Core/Caching/DistributedCacheClient.cs @@ -278,9 +278,9 @@ private IDistributedCache Cache /// Represents settings used by to serialize objects. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly DataContractJsonSerializerSettings SerializerSettings = new DataContractJsonSerializerSettings + private static readonly DataContractJsonSerializerSettings SerializerSettings = new() { - DateTimeFormat = new DateTimeFormat(DateTimeSerializationFormatString), + DateTimeFormat = new(DateTimeSerializationFormatString), EmitTypeInformation = EmitTypeInformation.AsNeeded, SerializeReadOnlyTypes = false }; diff --git a/src/RapidField.SolidInstruments.Core/Caching/InMemoryCacheClient.cs b/src/RapidField.SolidInstruments.Core/Caching/InMemoryCacheClient.cs index b88b63ba..214f5f6c 100644 --- a/src/RapidField.SolidInstruments.Core/Caching/InMemoryCacheClient.cs +++ b/src/RapidField.SolidInstruments.Core/Caching/InMemoryCacheClient.cs @@ -44,8 +44,8 @@ public InMemoryCacheClient(InMemoryCachingStrategy strategy) : base(strategy == InMemoryCachingStrategy.NoCaching ? ConcurrencyControlMode.Unconstrained : ConcurrencyControlMode.ProcessorCountSemaphore) { Strategy = strategy.RejectIf().IsEqualToValue(InMemoryCachingStrategy.Unspecified, nameof(strategy)); - LazyCache = IsOperative ? new Lazy(InitializeCache, LazyThreadSafetyMode.ExecutionAndPublication) : null; - LazyCacheOptions = IsOperative ? new Lazy>(InitializeCacheOptions, LazyThreadSafetyMode.ExecutionAndPublication) : null; + LazyCache = IsOperative ? new(InitializeCache, LazyThreadSafetyMode.ExecutionAndPublication) : null; + LazyCacheOptions = IsOperative ? new(InitializeCacheOptions, LazyThreadSafetyMode.ExecutionAndPublication) : null; } /// @@ -183,7 +183,7 @@ protected override void Write(String key, TValue value, IConcurrencyCont /// A new . /// [DebuggerHidden] - private MemoryCache InitializeCache() => new MemoryCache(CacheOptions); + private MemoryCache InitializeCache() => new(CacheOptions); /// /// Initializes the configuration options for . diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs index a654c215..ca552797 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControl.cs @@ -112,7 +112,7 @@ public void Dispose() /// /// A task representing the asynchronous operation. /// - public ValueTask DisposeAsync() => new ValueTask(Task.Factory.StartNew(Dispose)); + public ValueTask DisposeAsync() => new(Task.Factory.StartNew(Dispose)); /// /// Informs the control that a thread is entering a block of code or that it is beginning to consuming a resource. @@ -222,7 +222,7 @@ protected virtual void Dispose(Boolean disposing) return; } - lock (DisposalSyncRoot ?? new Object()) + lock (DisposalSyncRoot ?? new()) { if (IsDisposed) { @@ -354,13 +354,13 @@ public ConcurrencyControlConsumptionState ConsumptionState /// Represents an object that can be used to synchronize object disposal. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Object DisposalSyncRoot = new Object(); + private readonly Object DisposalSyncRoot = new(); /// /// Represents currently-in-use tokens that were issued by the current . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary Tokens = new ConcurrentDictionary(); + private readonly ConcurrentDictionary Tokens = new(); /// /// Represents the consumption state of the current . diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs index 0ba3fdff..c9053f6f 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/ConcurrencyControlToken.cs @@ -251,7 +251,7 @@ public void Dispose() /// /// A task representing the asynchronous operation. /// - public ValueTask DisposeAsync() => new ValueTask(Task.Factory.StartNew(Dispose)); + public ValueTask DisposeAsync() => new(Task.Factory.StartNew(Dispose)); /// /// Determines whether or not the current is equal to the specified diff --git a/src/RapidField.SolidInstruments.Core/Concurrency/SemaphoreControl.cs b/src/RapidField.SolidInstruments.Core/Concurrency/SemaphoreControl.cs index 747a99f8..393ec7e4 100644 --- a/src/RapidField.SolidInstruments.Core/Concurrency/SemaphoreControl.cs +++ b/src/RapidField.SolidInstruments.Core/Concurrency/SemaphoreControl.cs @@ -33,7 +33,7 @@ protected SemaphoreControl(Int32 maximumConcurrencyLimit, TimeSpan blockTimeoutT : base(blockTimeoutThreshold) { MaximumConcurrencyLimit = maximumConcurrencyLimit.RejectIf().IsLessThan(1, nameof(maximumConcurrencyLimit)); - Semaphore = new SemaphoreSlim(MaximumConcurrencyLimit); + Semaphore = new(MaximumConcurrencyLimit); } /// diff --git a/src/RapidField.SolidInstruments.Core/ConfigurableInstrument.cs b/src/RapidField.SolidInstruments.Core/ConfigurableInstrument.cs index 19144ebb..d574faa7 100644 --- a/src/RapidField.SolidInstruments.Core/ConfigurableInstrument.cs +++ b/src/RapidField.SolidInstruments.Core/ConfigurableInstrument.cs @@ -43,7 +43,7 @@ protected ConfigurableInstrument(IConfiguration applicationConfiguration) : base() { ApplicationConfiguration = applicationConfiguration.RejectIf().IsNull(nameof(applicationConfiguration)).TargetArgument; - LazyConfiguration = new Lazy(Configure, LazyThreadSafetyMode.PublicationOnly); + LazyConfiguration = new(Configure, LazyThreadSafetyMode.PublicationOnly); } /// @@ -134,7 +134,7 @@ private TConfiguration Configure() /// Represents a lazily-initialized default instance. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Lazy LazyDefaultConfiguration = new Lazy(InitializeDefaultConfiguration, LazyThreadSafetyMode.PublicationOnly); + private static readonly Lazy LazyDefaultConfiguration = new(InitializeDefaultConfiguration, LazyThreadSafetyMode.PublicationOnly); /// /// Represents configuration information for the application. diff --git a/src/RapidField.SolidInstruments.Core/DateTimeRange.cs b/src/RapidField.SolidInstruments.Core/DateTimeRange.cs index 326574d4..1a56a916 100644 --- a/src/RapidField.SolidInstruments.Core/DateTimeRange.cs +++ b/src/RapidField.SolidInstruments.Core/DateTimeRange.cs @@ -164,7 +164,7 @@ public static DateTimeRange Parse(String input) { if (Parse(input, out var start, out var end, out var granularity, true)) { - return new DateTimeRange(start, end, granularity); + return new(start, end, granularity); } return null; @@ -201,7 +201,7 @@ public static Boolean TryParse(String input, out DateTimeRange result) return false; } - result = new DateTimeRange(start, end, granularity); + result = new(start, end, granularity); return true; } @@ -587,7 +587,7 @@ private void CalculateLengthInMonthsAndYears(out Int32 lengthInMonths, out Int32 else if (End.Month == Start.Month) { // The end months and start month are the same, but the end day and time precedes the start day and time. - endPrecedesStartDuringYear = endPrecedesStartDuringMonth == true; + endPrecedesStartDuringYear = endPrecedesStartDuringMonth is true; } else { @@ -733,15 +733,15 @@ private void Initialize(DateTime start, DateTime end, DateTimeRangeGranularity g Start = start.Quantize(granularity); End = end.Quantize(granularity); Length = End - Start; - LazyLengthInDays = new Lazy(CalculateLengthInDays, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInHours = new Lazy(CalculateLengthInHours, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInMilliseconds = new Lazy(CalculateLengthInMilliseconds, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInMinutes = new Lazy(CalculateLengthInMinutes, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInMonths = new Lazy(CalculateLengthInMonths, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInSeconds = new Lazy(CalculateLengthInSeconds, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInWeeks = new Lazy(CalculateLengthInWeeks, LazyThreadSafetyMode.PublicationOnly); - LazyLengthInYears = new Lazy(CalculateLengthInYears, LazyThreadSafetyMode.PublicationOnly); - LazyMidpoint = new Lazy(CalculateMidpoint, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInDays = new(CalculateLengthInDays, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInHours = new(CalculateLengthInHours, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInMilliseconds = new(CalculateLengthInMilliseconds, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInMinutes = new(CalculateLengthInMinutes, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInMonths = new(CalculateLengthInMonths, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInSeconds = new(CalculateLengthInSeconds, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInWeeks = new(CalculateLengthInWeeks, LazyThreadSafetyMode.PublicationOnly); + LazyLengthInYears = new(CalculateLengthInYears, LazyThreadSafetyMode.PublicationOnly); + LazyMidpoint = new(CalculateMidpoint, LazyThreadSafetyMode.PublicationOnly); } /// diff --git a/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs index 6751268c..abeec077 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/ByteCollectionExtensions.cs @@ -100,7 +100,7 @@ public static Byte[] Decompress(this Byte[] target) /// /// A new that uniquely identifies the contents of the current . /// - public static Guid GenerateChecksumIdentity(this IEnumerable target) => new Guid(target.ComputeOneHundredTwentyEightBitHashBuffer()); + public static Guid GenerateChecksumIdentity(this IEnumerable target) => new(target.ComputeOneHundredTwentyEightBitHashBuffer()); /// /// Performs a circular shift on the bits in the current array. diff --git a/src/RapidField.SolidInstruments.Core/Extensions/ByteExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/ByteExtensions.cs index 176731cb..caf7fb18 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/ByteExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/ByteExtensions.cs @@ -27,7 +27,7 @@ public static class ByteExtensions /// Represents a substitution box for reversed-bit-order bytes. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Byte[] ReverseBitOrderSubstitutionBox = new Byte[] + private static readonly Byte[] ReverseBitOrderSubstitutionBox = { 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, diff --git a/src/RapidField.SolidInstruments.Core/Extensions/CharacterExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/CharacterExtensions.cs index d374116c..1a8e1d19 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/CharacterExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/CharacterExtensions.cs @@ -34,7 +34,7 @@ public static class CharacterExtensions /// if the current represents a Unicode basic Latin character, otherwise /// . /// - public static Boolean IsBasicLatin(this Char target) => Regex.IsMatch(new String(target, 1), "[\x00-\x7f]"); + public static Boolean IsBasicLatin(this Char target) => Regex.IsMatch(new(target, 1), "[\x00-\x7f]"); /// /// Determines whether or not the current represents a Unicode control character. diff --git a/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs index 75819e0b..18645432 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/DateTimeExtensions.cs @@ -22,7 +22,7 @@ public static class DateTimeExtensions /// /// A representing the start of the day of the current . /// - public static DateTime BeginningOfThisDay(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, 0, 0, 0, 0, target.Kind); + public static DateTime BeginningOfThisDay(this DateTime target) => new(target.Year, target.Month, target.Day, 0, 0, 0, 0, target.Kind); /// /// Defines a representing the start of the hour of the current . @@ -33,7 +33,7 @@ public static class DateTimeExtensions /// /// A representing the start of the hour of the current . /// - public static DateTime BeginningOfThisHour(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, 0, 0, 0, target.Kind); + public static DateTime BeginningOfThisHour(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, 0, 0, 0, target.Kind); /// /// Defines a representing the start of the millisecond of the current . @@ -54,7 +54,7 @@ public static DateTime BeginningOfThisMillisecond(this DateTime target) } target = target.Add(SingleTick); - return new DateTime(target.Ticks, target.Kind); + return new(target.Ticks, target.Kind); } /// @@ -66,7 +66,7 @@ public static DateTime BeginningOfThisMillisecond(this DateTime target) /// /// A representing the start of the minute of the current . /// - public static DateTime BeginningOfThisMinute(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, target.Minute, 0, 0, target.Kind); + public static DateTime BeginningOfThisMinute(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, target.Minute, 0, 0, target.Kind); /// /// Defines a representing the start of the month of the current . @@ -77,7 +77,7 @@ public static DateTime BeginningOfThisMillisecond(this DateTime target) /// /// A representing the start of the month of the current . /// - public static DateTime BeginningOfThisMonth(this DateTime target) => new DateTime(target.Year, target.Month, 1, 0, 0, 0, 0, target.Kind); + public static DateTime BeginningOfThisMonth(this DateTime target) => new(target.Year, target.Month, 1, 0, 0, 0, 0, target.Kind); /// /// Defines a representing the start of the second of the current . @@ -88,7 +88,7 @@ public static DateTime BeginningOfThisMillisecond(this DateTime target) /// /// A representing the start of the second of the current . /// - public static DateTime BeginningOfThisSecond(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, target.Minute, target.Second, 0, target.Kind); + public static DateTime BeginningOfThisSecond(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, target.Minute, target.Second, 0, target.Kind); /// /// Defines a representing the start of the year of the current . @@ -99,7 +99,7 @@ public static DateTime BeginningOfThisMillisecond(this DateTime target) /// /// A representing the start of the year of the current . /// - public static DateTime BeginningOfThisYear(this DateTime target) => new DateTime(target.Year, 1, 1, 0, 0, 0, 0, target.Kind); + public static DateTime BeginningOfThisYear(this DateTime target) => new(target.Year, 1, 1, 0, 0, 0, 0, target.Kind); /// /// Defines an integer representing the calendar quarter of the current . @@ -182,7 +182,7 @@ public static DayOfWeekMonthlyOrdinal DayOfWeekOrdinal(this DateTime target) /// /// A representing the midpoint of the day of the current . /// - public static DateTime MidpointOfThisDay(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, 12, 0, 0, 0, target.Kind); + public static DateTime MidpointOfThisDay(this DateTime target) => new(target.Year, target.Month, target.Day, 12, 0, 0, 0, target.Kind); /// /// Defines a representing the midpoint of the hour of the current . @@ -193,7 +193,7 @@ public static DayOfWeekMonthlyOrdinal DayOfWeekOrdinal(this DateTime target) /// /// A representing the midpoint of the hour of the current . /// - public static DateTime MidpointOfThisHour(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, 30, 0, 0, target.Kind); + public static DateTime MidpointOfThisHour(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, 30, 0, 0, target.Kind); /// /// Defines a representing the midpoint of the millisecond of the current . @@ -215,7 +215,7 @@ public static DayOfWeekMonthlyOrdinal DayOfWeekOrdinal(this DateTime target) /// /// A representing the midpoint of the minute of the current . /// - public static DateTime MidpointOfThisMinute(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, target.Minute, 30, 0, target.Kind); + public static DateTime MidpointOfThisMinute(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, target.Minute, 30, 0, target.Kind); /// /// Defines a representing the midpoint of the month of the current . @@ -234,19 +234,19 @@ public static DateTime MidpointOfThisMonth(this DateTime target) { case 28: - return new DateTime(target.Year, target.Month, 15, 0, 0, 0, 0, target.Kind); + return new(target.Year, target.Month, 15, 0, 0, 0, 0, target.Kind); case 29: - return new DateTime(target.Year, target.Month, 15, 12, 0, 0, 0, target.Kind); + return new(target.Year, target.Month, 15, 12, 0, 0, 0, target.Kind); case 30: - return new DateTime(target.Year, target.Month, 16, 0, 0, 0, 0, target.Kind); + return new(target.Year, target.Month, 16, 0, 0, 0, 0, target.Kind); case 31: - return new DateTime(target.Year, target.Month, 16, 12, 0, 0, 0, target.Kind); + return new(target.Year, target.Month, 16, 12, 0, 0, 0, target.Kind); default: @@ -263,7 +263,7 @@ public static DateTime MidpointOfThisMonth(this DateTime target) /// /// A representing the midpoint of the second of the current . /// - public static DateTime MidpointOfThisSecond(this DateTime target) => new DateTime(target.Year, target.Month, target.Day, target.Hour, target.Minute, target.Second, 500, target.Kind); + public static DateTime MidpointOfThisSecond(this DateTime target) => new(target.Year, target.Month, target.Day, target.Hour, target.Minute, target.Second, 500, target.Kind); /// /// Defines a representing the midpoint of the year of the current . @@ -279,11 +279,11 @@ public static DateTime MidpointOfThisYear(this DateTime target) if (DateTime.IsLeapYear(target.Year)) { // Midnight on 1-Jul is the midpoint for leap years. - return new DateTime(target.Year, 7, 2, 0, 0, 0, 0, target.Kind); + return new(target.Year, 7, 2, 0, 0, 0, 0, target.Kind); } // Noon on 2-Jul is the midpoint for non-leap years. - return new DateTime(target.Year, 7, 2, 12, 0, 0, 0, target.Kind); + return new(target.Year, 7, 2, 12, 0, 0, 0, target.Kind); } /// @@ -349,11 +349,11 @@ public static TimeOfDay ToTimeOfDay(this DateTime target) { case DateTimeKind.Local: - return new TimeOfDay(TimeZoneInfo.Local, target.Hour, target.Minute, target.Second, target.Millisecond); + return new(TimeZoneInfo.Local, target.Hour, target.Minute, target.Second, target.Millisecond); case DateTimeKind.Utc: - return new TimeOfDay(TimeZoneInfo.Utc, target.Hour, target.Minute, target.Second, target.Millisecond); + return new(TimeZoneInfo.Utc, target.Hour, target.Minute, target.Second, target.Millisecond); case DateTimeKind.Unspecified: diff --git a/src/RapidField.SolidInstruments.Core/Extensions/EnumExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/EnumExtensions.cs index a05ca71b..612a43df 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/EnumExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/EnumExtensions.cs @@ -22,6 +22,6 @@ public static class EnumExtensions /// An integer and textual name pair representation of the current . /// public static KeyValuePair ToKeyValuePair(this T target) - where T : Enum => new KeyValuePair(Convert.ToInt32(target), Enum.GetName(typeof(T), target)); + where T : Enum => new(Convert.ToInt32(target), Enum.GetName(typeof(T), target)); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Core/Extensions/ObjectExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/ObjectExtensions.cs index cfb8dff0..245114a7 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/ObjectExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/ObjectExtensions.cs @@ -342,9 +342,9 @@ private static Byte[] Serialize(DataContractJsonSerializer serializer, Object ta /// Represents settings used by to serialize objects. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly DataContractJsonSerializerSettings GetImpliedHashCodeSerializerSettings = new DataContractJsonSerializerSettings + private static readonly DataContractJsonSerializerSettings GetImpliedHashCodeSerializerSettings = new() { - DateTimeFormat = new DateTimeFormat(DateTimeSerializationFormatString), + DateTimeFormat = new(DateTimeSerializationFormatString), EmitTypeInformation = EmitTypeInformation.Always, SerializeReadOnlyTypes = true }; @@ -353,9 +353,9 @@ private static Byte[] Serialize(DataContractJsonSerializer serializer, Object ta /// Represents settings used by to serialize objects. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly DataContractJsonSerializerSettings GetSerializedCloneSerializerSettings = new DataContractJsonSerializerSettings + private static readonly DataContractJsonSerializerSettings GetSerializedCloneSerializerSettings = new() { - DateTimeFormat = new DateTimeFormat(DateTimeSerializationFormatString), + DateTimeFormat = new(DateTimeSerializationFormatString), EmitTypeInformation = EmitTypeInformation.AsNeeded, SerializeReadOnlyTypes = false }; diff --git a/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs b/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs index 970bca83..26bd7d32 100644 --- a/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs +++ b/src/RapidField.SolidInstruments.Core/Extensions/UriExtensions.cs @@ -89,11 +89,11 @@ public static Uri AppendQueryStringData(this Uri target, IDictionary(InitializeStateControl, LazyThreadSafetyMode.ExecutionAndPublication); + LazyStateControl = new(InitializeStateControl, LazyThreadSafetyMode.ExecutionAndPublication); } #pragma warning disable CA1063 @@ -92,7 +92,7 @@ public void Dispose() return; } - lock (DisposalSyncRoot ?? new Object()) + lock (DisposalSyncRoot ?? new()) { if (IsDisposedOrDisposing) { @@ -125,7 +125,7 @@ public void Dispose() /// /// A task representing the asynchronous operation. /// - public ValueTask DisposeAsync() => new ValueTask(Task.Factory.StartNew(Dispose)); + public ValueTask DisposeAsync() => new(Task.Factory.StartNew(Dispose)); /// /// Initializes a concurrency control mechanism that is used to manage state for the current . @@ -231,7 +231,7 @@ protected Boolean IsDisposing /// Represents an object that can be used to synchronize object disposal. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Object DisposalSyncRoot = new Object(); + private readonly Object DisposalSyncRoot = new(); /// /// Represents a lazily-initialized concurrency control mechanism that is used to manage state for the current diff --git a/src/RapidField.SolidInstruments.Core/Nix.cs b/src/RapidField.SolidInstruments.Core/Nix.cs index 03a8d06d..2c8ad96b 100644 --- a/src/RapidField.SolidInstruments.Core/Nix.cs +++ b/src/RapidField.SolidInstruments.Core/Nix.cs @@ -387,7 +387,7 @@ private Nix(Byte value) /// /// Represents a static instance. /// - public static readonly Nix Instance = new Nix(0x00); + public static readonly Nix Instance = new(0x00); /// /// Represents a static reference to the type. diff --git a/src/RapidField.SolidInstruments.Core/ReferenceManager.cs b/src/RapidField.SolidInstruments.Core/ReferenceManager.cs index 9af5e54f..8c569d14 100644 --- a/src/RapidField.SolidInstruments.Core/ReferenceManager.cs +++ b/src/RapidField.SolidInstruments.Core/ReferenceManager.cs @@ -168,7 +168,7 @@ private void Prune() /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); /// /// Represents the objects that are managed by the current . @@ -275,7 +275,7 @@ public void Dispose() /// A task representing the asynchronous operation. /// [DebuggerHidden] - public ValueTask DisposeAsync() => new ValueTask(Task.Factory.StartNew(Dispose)); + public ValueTask DisposeAsync() => new(Task.Factory.StartNew(Dispose)); /// /// Determines whether or not the current is equal to the specified diff --git a/src/RapidField.SolidInstruments.Core/SemanticVersion.cs b/src/RapidField.SolidInstruments.Core/SemanticVersion.cs index 2706c7a2..6a045406 100644 --- a/src/RapidField.SolidInstruments.Core/SemanticVersion.cs +++ b/src/RapidField.SolidInstruments.Core/SemanticVersion.cs @@ -160,7 +160,7 @@ public static SemanticVersion OfAssembly(Assembly assembly) var minorVersion = Convert.ToUInt64(assemblyVersion.Minor < 0 ? 0 : assemblyVersion.Minor); var patchVersion = Convert.ToUInt64(assemblyVersion.Revision < 0 ? 0 : assemblyVersion.Revision); var buildMetadata = assemblyVersion.Build > 0 ? assemblyVersion.Build.ToString() : null; - return new SemanticVersion(majorVersion, minorVersion, patchVersion, null, buildMetadata); + return new(majorVersion, minorVersion, patchVersion, null, buildMetadata); } /// @@ -514,7 +514,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextMajorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion + 1, 0, 0, preReleaseLabel, buildMetadata); + public SemanticVersion NextMajorVersion(String preReleaseLabel, String buildMetadata) => new(MajorVersion + 1, 0, 0, preReleaseLabel, buildMetadata); /// /// Returns the next minor version after the current . @@ -554,7 +554,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextMinorVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, MinorVersion + 1, 0, preReleaseLabel, buildMetadata); + public SemanticVersion NextMinorVersion(String preReleaseLabel, String buildMetadata) => new(MajorVersion, MinorVersion + 1, 0, preReleaseLabel, buildMetadata); /// /// Returns the next patch version after the current . @@ -594,7 +594,7 @@ public override Int32 GetHashCode() /// /// is invalid -or- is invalid. /// - public SemanticVersion NextPatchVersion(String preReleaseLabel, String buildMetadata) => new SemanticVersion(MajorVersion, MinorVersion, PatchVersion + 1, preReleaseLabel, buildMetadata); + public SemanticVersion NextPatchVersion(String preReleaseLabel, String buildMetadata) => new(MajorVersion, MinorVersion, PatchVersion + 1, preReleaseLabel, buildMetadata); /// /// Converts the value of the current to its equivalent string representation. @@ -715,7 +715,7 @@ private static Boolean Parse(String input, out SemanticVersion result, Boolean r var patchVersion = UInt64.Parse(patchVersionString); var preReleaseLabel = matchGroups.Where(group => group.Success && group.Name == PatternGroupNameForPreReleaseLabel).SingleOrDefault()?.Value; var buildMetadata = matchGroups.Where(group => group.Success && group.Name == PatternGroupNameForBuildMetadata).SingleOrDefault()?.Value; - result = new SemanticVersion(majorVersion, minorVersion, patchVersion, preReleaseLabel, buildMetadata); + result = new(majorVersion, minorVersion, patchVersion, preReleaseLabel, buildMetadata); return true; } catch (Exception exception) @@ -801,12 +801,12 @@ private static String ProcessPreReleaseLabel(String preReleaseLabel) /// /// Gets a equivalent to version 1.0.0. /// - public static SemanticVersion One => new SemanticVersion(1); + public static SemanticVersion One => new(1); /// /// Gets a equivalent to version 0.0.0. /// - public static SemanticVersion Zero => new SemanticVersion(0); + public static SemanticVersion Zero => new(0); /// /// Gets or sets the build metadata, if there is no metadata. @@ -985,7 +985,7 @@ public String PreReleaseLabel /// Represents prefix characters that are ignored by . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Char[] IgnoredPrefixCharacters = new Char[2] { 'v', 'V' }; + private static readonly Char[] IgnoredPrefixCharacters = new[] { 'v', 'V' }; /// /// Represents a regular expression that is used to validate a complete semantic version. diff --git a/src/RapidField.SolidInstruments.Core/TimeOfDay.cs b/src/RapidField.SolidInstruments.Core/TimeOfDay.cs index 87b35790..f7b1d2cf 100644 --- a/src/RapidField.SolidInstruments.Core/TimeOfDay.cs +++ b/src/RapidField.SolidInstruments.Core/TimeOfDay.cs @@ -288,7 +288,7 @@ public static Boolean TryParse(String input, out TimeOfDay result) return false; } - result = new TimeOfDay(zone, hour, minute, second, millisecond); + result = new(zone, hour, minute, second, millisecond); return true; } @@ -298,7 +298,7 @@ public static Boolean TryParse(String input, out TimeOfDay result) /// /// A representing the start of the hour of the current . /// - public TimeOfDay BeginningOfThisHour() => new TimeOfDay(Zone, Hour, 0, 0, 0); + public TimeOfDay BeginningOfThisHour() => new(Zone, Hour, 0, 0, 0); /// /// Defines a representing the start of the minute of the current . @@ -306,7 +306,7 @@ public static Boolean TryParse(String input, out TimeOfDay result) /// /// A representing the start of the minute of the current . /// - public TimeOfDay BeginningOfThisMinute() => new TimeOfDay(Zone, Hour, Minute, 0, 0); + public TimeOfDay BeginningOfThisMinute() => new(Zone, Hour, Minute, 0, 0); /// /// Defines a representing the start of the second of the current . @@ -314,7 +314,7 @@ public static Boolean TryParse(String input, out TimeOfDay result) /// /// A representing the start of the second of the current . /// - public TimeOfDay BeginningOfThisSecond() => new TimeOfDay(Zone, Hour, Minute, Second, 0); + public TimeOfDay BeginningOfThisSecond() => new(Zone, Hour, Minute, Second, 0); /// /// Creates a new that is an identical copy of the current . @@ -649,7 +649,7 @@ public TimeOfDay ToUniversalTime() utcHour -= 24; } - return new TimeOfDay(TimeZoneInfo.Utc, utcHour, utcMinute, Second, Millisecond); + return new(TimeZoneInfo.Utc, utcHour, utcMinute, Second, Millisecond); } /// diff --git a/src/RapidField.SolidInstruments.Core/TimeStamp.cs b/src/RapidField.SolidInstruments.Core/TimeStamp.cs index 205f2b06..84ac0429 100644 --- a/src/RapidField.SolidInstruments.Core/TimeStamp.cs +++ b/src/RapidField.SolidInstruments.Core/TimeStamp.cs @@ -92,7 +92,7 @@ internal void UseKind(DateTimeKind kind) /// Represents a singleton instance of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly TimeStamp Instance = new TimeStamp(); + internal static readonly TimeStamp Instance = new(); /// /// Represents the default concurrency control mode for new instances. @@ -110,7 +110,7 @@ internal void UseKind(DateTimeKind kind) /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); /// /// Represents the that is used by the current when producing the diff --git a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/AsymmetricKeyPair.cs b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/AsymmetricKeyPair.cs index 98318214..5a7f540b 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/AsymmetricKeyPair.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/AsymmetricKeyPair.cs @@ -66,9 +66,9 @@ protected AsymmetricKeyPair(Guid identifier, TAlgorithm algorithm, TimeSpan keyL : base(identifier, algorithm, keyLifespanDuration) { IsReconstituted = isReconstituted; - LazyPrivateKey = new Lazy(InitializePrivateKey, LazyThreadSafetyMode.ExecutionAndPublication); - LazyProvider = new Lazy(InitializeProvider, LazyThreadSafetyMode.ExecutionAndPublication); - LazyPublicKey = new Lazy(InitializePublicKey, LazyThreadSafetyMode.ExecutionAndPublication); + LazyPrivateKey = new(InitializePrivateKey, LazyThreadSafetyMode.ExecutionAndPublication); + LazyProvider = new(InitializeProvider, LazyThreadSafetyMode.ExecutionAndPublication); + LazyPublicKey = new(InitializePublicKey, LazyThreadSafetyMode.ExecutionAndPublication); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/DigitalSignaturePublicKey.cs b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/DigitalSignaturePublicKey.cs index 3acd2696..7587983c 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/DigitalSignaturePublicKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/DigitalSignaturePublicKey.cs @@ -121,7 +121,7 @@ protected DigitalSignaturePublicKey(Guid keyPairIdentifier, DigitalSignatureAlgo { Algorithm = algorithm.RejectIf().IsEqualToValue(DigitalSignatureAlgorithmSpecification.Unspecified, nameof(algorithm)); ExpirationTimeStamp = expirationTimeStamp.RejectIf().IsEqualToValue(DateTime.MaxValue, nameof(expirationTimeStamp)); - KeyMemory = new PinnedMemory(keyMemory.RejectIf().IsNullOrEmpty(nameof(keyMemory)).OrIf(argument => argument.Length != (algorithm.ToPublicKeyBitLength() / 8), nameof(keyMemory), $"The length of the specified key is invalid for the specified algorithm, \"{algorithm}\"."), true); + KeyMemory = new(keyMemory.RejectIf().IsNullOrEmpty(nameof(keyMemory)).OrIf(argument => argument.Length != (algorithm.ToPublicKeyBitLength() / 8), nameof(keyMemory), $"The length of the specified key is invalid for the specified algorithm, \"{algorithm}\"."), true); KeyPairIdentifier = keyPairIdentifier.RejectIf().IsEqualToValue(Guid.Empty, nameof(keyPairIdentifier)); Purpose = AsymmetricKeyPurpose.DigitalSignature; } @@ -160,7 +160,7 @@ public String ToBase64String() /// /// The object is disposed. /// - public AsymmetricPublicKeyModel ToModel() => new AsymmetricPublicKeyModel(KeyPairIdentifier, ToBase64String(), ExpirationTimeStamp); + public AsymmetricPublicKeyModel ToModel() => new(KeyPairIdentifier, ToBase64String(), ExpirationTimeStamp); /// /// Converts the value of the current to its equivalent string representation. diff --git a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/Ecdsa/EcdsaKeyPair.cs b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/Ecdsa/EcdsaKeyPair.cs index 91372ed8..d3db8e78 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/Ecdsa/EcdsaKeyPair.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/DigitalSignature/Ecdsa/EcdsaKeyPair.cs @@ -60,7 +60,7 @@ internal EcdsaKeyPair(DigitalSignatureAlgorithmSpecification algorithm, Boolean protected sealed override EcdsaPrivateKey InitializePrivateKey(DigitalSignatureAlgorithmSpecification algorithm, ECDsa provider, Boolean isReconstituted) { using var keySource = new PinnedMemory(provider.ExportECPrivateKey()); - return new EcdsaPrivateKey(Identifier, algorithm, keySource, KeyLifespanDuration); + return new(Identifier, algorithm, keySource, KeyLifespanDuration); } /// @@ -95,7 +95,7 @@ protected sealed override EcdsaPrivateKey InitializePrivateKey(DigitalSignatureA protected sealed override EcdsaPublicKey InitializePublicKey(DigitalSignatureAlgorithmSpecification algorithm, ECDsa provider, Boolean isReconstituted) { var keyMemory = provider.ExportSubjectPublicKeyInfo(); - return new EcdsaPublicKey(Identifier, algorithm, keyMemory, KeyLifespanDuration); + return new(Identifier, algorithm, keyMemory, KeyLifespanDuration); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/Ecdh/EcdhKeyPair.cs b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/Ecdh/EcdhKeyPair.cs index 1c255187..78bcdc8e 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/Ecdh/EcdhKeyPair.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/Ecdh/EcdhKeyPair.cs @@ -91,7 +91,7 @@ protected sealed override ISecureMemory DeriveSymmetricKeyMaterial(ECDiffieHellm protected sealed override EcdhPrivateKey InitializePrivateKey(KeyExchangeAlgorithmSpecification algorithm, ECDiffieHellman provider, Boolean isReconstituted) { using var keySource = new PinnedMemory(provider.ExportECPrivateKey()); - return new EcdhPrivateKey(Identifier, algorithm, keySource, KeyLifespanDuration); + return new(Identifier, algorithm, keySource, KeyLifespanDuration); } /// @@ -126,7 +126,7 @@ protected sealed override EcdhPrivateKey InitializePrivateKey(KeyExchangeAlgorit protected sealed override EcdhPublicKey InitializePublicKey(KeyExchangeAlgorithmSpecification algorithm, ECDiffieHellman provider, Boolean isReconstituted) { var keyMemory = provider.ExportSubjectPublicKeyInfo(); - return new EcdhPublicKey(Identifier, algorithm, keyMemory, KeyLifespanDuration); + return new(Identifier, algorithm, keyMemory, KeyLifespanDuration); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/KeyExchangePublicKey.cs b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/KeyExchangePublicKey.cs index 22cd09ad..eb49409a 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/KeyExchangePublicKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Asymmetric/KeyExchange/KeyExchangePublicKey.cs @@ -121,7 +121,7 @@ protected KeyExchangePublicKey(Guid keyPairIdentifier, KeyExchangeAlgorithmSpeci { Algorithm = algorithm.RejectIf().IsEqualToValue(KeyExchangeAlgorithmSpecification.Unspecified, nameof(algorithm)); ExpirationTimeStamp = expirationTimeStamp.RejectIf().IsEqualToValue(DateTime.MaxValue, nameof(expirationTimeStamp)); - KeyMemory = new PinnedMemory(keyMemory.RejectIf().IsNullOrEmpty(nameof(keyMemory)).OrIf(argument => argument.Length != (algorithm.ToPublicKeyBitLength() / 8), nameof(keyMemory), $"The length of the specified key is invalid for the specified algorithm, \"{algorithm}\"."), true); + KeyMemory = new(keyMemory.RejectIf().IsNullOrEmpty(nameof(keyMemory)).OrIf(argument => argument.Length != (algorithm.ToPublicKeyBitLength() / 8), nameof(keyMemory), $"The length of the specified key is invalid for the specified algorithm, \"{algorithm}\"."), true); KeyPairIdentifier = keyPairIdentifier.RejectIf().IsEqualToValue(Guid.Empty, nameof(keyPairIdentifier)); Purpose = AsymmetricKeyPurpose.KeyExchange; } @@ -160,7 +160,7 @@ public String ToBase64String() /// /// The object is disposed. /// - public AsymmetricPublicKeyModel ToModel() => new AsymmetricPublicKeyModel(KeyPairIdentifier, ToBase64String(), ExpirationTimeStamp); + public AsymmetricPublicKeyModel ToModel() => new(KeyPairIdentifier, ToBase64String(), ExpirationTimeStamp); /// /// Converts the value of the current to its equivalent string representation. diff --git a/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs b/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs index 97f173ba..cd8dc1ee 100644 --- a/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/CryptographicKey.cs @@ -66,7 +66,7 @@ protected CryptographicKey(TAlgorithm algorithm, CryptographicKeyDerivationMode Algorithm = algorithm.RejectIf().IsEqualToValue(default, nameof(algorithm)); DerivationMode = derivationMode.RejectIf().IsEqualToValue(CryptographicKeyDerivationMode.Unspecified, nameof(derivationMode)); KeySource = new SecureMemory(KeySourceLengthInBytes); - LazyPbkdf2Provider = new Lazy(InitializePbkdf2Algorithm, LazyThreadSafetyMode.ExecutionAndPublication); + LazyPbkdf2Provider = new(InitializePbkdf2Algorithm, LazyThreadSafetyMode.ExecutionAndPublication); // Gather information about the derived key. DerivedKeyLength = derivedKeyLengthInBits.RejectIf().IsLessThanOrEqualTo(0, nameof(derivedKeyLengthInBits)).TargetArgument / 8; @@ -406,7 +406,7 @@ public TAlgorithm Algorithm /// probably few good reasons to. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly PinnedMemory SecureMemoryEncryptionKey = new PinnedMemory(new Byte[] + internal static readonly PinnedMemory SecureMemoryEncryptionKey = new(new Byte[] { 0xaa, 0xf0, 0xcc, 0xff, 0x00, 0x33, 0x0f, 0x55, 0xff, 0xcc, 0xf0, 0xaa, 0x55, 0x0f, 0x33, 0x00 }); @@ -451,7 +451,7 @@ public TAlgorithm Algorithm /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); /// /// Represents the substitution bytes that are used to fulfill key derivation operations when @@ -586,7 +586,7 @@ internal static PinnedMemory DeriveKeySourceBytesFromKeyMaterial(Byte[] keyMater using (var saltBytes = new ReadOnlyPinnedMemory(hashingProcessor.CalculateHash(keyMaterial, PasswordSaltHashingAlgorithm))) { var pbkdf2Provider = new Rfc2898DeriveBytes(keyMaterial, saltBytes, Pbkdf2MinimumIterationCount); - return new PinnedMemory(pbkdf2Provider.GetBytes(keySourceLengthInBytes.RejectIf().IsLessThanOrEqualTo(0, nameof(keySourceLengthInBytes)))); + return new(pbkdf2Provider.GetBytes(keySourceLengthInBytes.RejectIf().IsLessThanOrEqualTo(0, nameof(keySourceLengthInBytes)))); } } diff --git a/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs b/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs index 8e6829e7..8be45275 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Extensions/RandomNumberGeneratorExtensions.cs @@ -1690,7 +1690,7 @@ private static void GenerateChar(RandomNumberGenerator target, Boolean permitNon private static void GenerateDateTime(RandomNumberGenerator target, out DateTime randomValue) { GenerateInt64(target, DateTimeTickFloor, DateTimeTickCeiling, out var ticks); - randomValue = new DateTime(ticks, RandomDateTimeKind); + randomValue = new(ticks, RandomDateTimeKind); } /// @@ -1712,7 +1712,7 @@ private static void GenerateDateTime(RandomNumberGenerator target, out DateTime private static void GenerateDateTime(RandomNumberGenerator target, DateTime floor, DateTime ceiling, out DateTime randomValue) { GenerateInt64(target, floor.Ticks, ceiling.Ticks, out var ticks); - randomValue = new DateTime(ticks, RandomDateTimeKind); + randomValue = new(ticks, RandomDateTimeKind); } /// @@ -1739,7 +1739,7 @@ private static void GenerateDecimal(RandomNumberGenerator target, out Decimal ra target.GetBytes(scale); } - randomValue = new Decimal(lowBits, middleBits, highBits, isNegative, scale[0]); + randomValue = new(lowBits, middleBits, highBits, isNegative, scale[0]); } /// @@ -1919,7 +1919,7 @@ private static void GenerateInt64(RandomNumberGenerator target, out Int64 random [DebuggerHidden] private static void GenerateInt64(RandomNumberGenerator target, Int64 floor, Int64 ceiling, out Int64 randomValue) { - var range = BigInteger.Subtract(new BigInteger(ceiling), new BigInteger(floor)); + var range = BigInteger.Subtract(new(ceiling), new(floor)); GenerateRangePosition(target, (Decimal)range, out var rangePosition); randomValue = Convert.ToInt64(floor + rangePosition.RoundedTo(0)); } @@ -2051,7 +2051,7 @@ private static void GenerateString(RandomNumberGenerator target, Int32 character buffer[i] = randomCharacter; } - randomValue = new String(buffer); + randomValue = new(buffer); } /// @@ -2067,7 +2067,7 @@ private static void GenerateString(RandomNumberGenerator target, Int32 character private static void GenerateTimeSpan(RandomNumberGenerator target, out TimeSpan randomValue) { GenerateInt64(target, TimeSpanTickFloor, TimeSpanTickCeiling, out var ticks); - randomValue = new TimeSpan(ticks); + randomValue = new(ticks); } /// @@ -2089,7 +2089,7 @@ private static void GenerateTimeSpan(RandomNumberGenerator target, out TimeSpan private static void GenerateTimeSpan(RandomNumberGenerator target, TimeSpan floor, TimeSpan ceiling, out TimeSpan randomValue) { GenerateInt64(target, floor.Ticks, ceiling.Ticks, out var ticks); - randomValue = new TimeSpan(ticks); + randomValue = new(ticks); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs b/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs index ff94b49a..54b7c04d 100644 --- a/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs +++ b/src/RapidField.SolidInstruments.Cryptography/HardenedRandomNumberGenerator.cs @@ -28,8 +28,8 @@ internal sealed class HardenedRandomNumberGenerator : RandomNumberGenerator [DebuggerHidden] private HardenedRandomNumberGenerator() { - LazyCipher = new Lazy(InitializeCipher, LazyThreadSafetyMode.PublicationOnly); - LazySourceRandomnessProvider = new Lazy(InitializeSourceRandomnessProvider, LazyThreadSafetyMode.PublicationOnly); + LazyCipher = new(InitializeCipher, LazyThreadSafetyMode.PublicationOnly); + LazySourceRandomnessProvider = new(InitializeSourceRandomnessProvider, LazyThreadSafetyMode.PublicationOnly); } /// @@ -86,7 +86,7 @@ protected override void Dispose(Boolean disposing) { try { - lock (SyncRoot ?? new Object()) + lock (SyncRoot ?? new()) { LazyCipher?.Dispose(); LazySourceRandomnessProvider?.Dispose(); @@ -177,7 +177,7 @@ private void PermuteBuffer() /// Represents a singleton instance of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly HardenedRandomNumberGenerator Instance = new HardenedRandomNumberGenerator(); + internal static readonly HardenedRandomNumberGenerator Instance = new(); /// /// Represents the number of source bytes generated for a single round of . @@ -213,13 +213,13 @@ private void PermuteBuffer() /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); /// /// Represents a synchronized stack of processed (encrypted) bytes. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentStack Buffer = new ConcurrentStack(); + private readonly ConcurrentStack Buffer = new(); /// /// Represents a lazily-initialized symmetric-key cipher that is used to harden platform-generated bytes. @@ -238,6 +238,6 @@ private void PermuteBuffer() /// Represents an object that is used to synchronize access to the generator. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Object SyncRoot = new Object(); + private readonly Object SyncRoot = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Cryptography/Hashing/Argon2/Argon2HashAlgorithm.cs b/src/RapidField.SolidInstruments.Cryptography/Hashing/Argon2/Argon2HashAlgorithm.cs index d9c581cf..75de5584 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Hashing/Argon2/Argon2HashAlgorithm.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Hashing/Argon2/Argon2HashAlgorithm.cs @@ -204,6 +204,6 @@ protected override sealed Byte[] ComputeHash(PinnedMemory plaintext, PinnedMemor /// dictionary attacks. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Byte[] DefaultAssociatedData = new Byte[] { 0xcc, 0xf0, 0x3c, 0x03, 0xaf, 0xa5, 0x0f, 0xca, 0xac, 0xf0, 0x5a, 0xfa, 0x30, 0xc3, 0x0f, 0xcc }; + private static readonly Byte[] DefaultAssociatedData = { 0xcc, 0xf0, 0x3c, 0x03, 0xaf, 0xa5, 0x0f, 0xca, 0xac, 0xf0, 0x5a, 0xfa, 0x30, 0xc3, 0x0f, 0xcc }; } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashAlgorithmBase.cs b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashAlgorithmBase.cs index bf57313a..cc9173b6 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Hashing/HashAlgorithmBase.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Hashing/HashAlgorithmBase.cs @@ -129,7 +129,7 @@ private static PinnedMemory DeriveDeterministicSaltValue(IReadOnlyPinnedMemory ConvertValueToBytes(Cascad { secureMemory.Access(memory => { - result = new ReadOnlyPinnedMemory(memory.ToArray()); + result = new(memory.ToArray()); }); } diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/GuidSecret.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/GuidSecret.cs index bdf2d514..b26fa880 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/GuidSecret.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/GuidSecret.cs @@ -69,7 +69,7 @@ public static GuidSecret FromValue(String name, Guid value) /// /// The resulting . /// - protected sealed override Guid ConvertBytesToValue(IReadOnlyPinnedMemory bytes, IConcurrencyControlToken controlToken) => new Guid(bytes.ReadOnlySpan); + protected sealed override Guid ConvertBytesToValue(IReadOnlyPinnedMemory bytes, IConcurrencyControlToken controlToken) => new(bytes.ReadOnlySpan); /// /// Gets the bytes of , pins them in memory and returns the resulting diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/PasswordCompositionRequirements.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/PasswordCompositionRequirements.cs index e212d034..d3b104e7 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/PasswordCompositionRequirements.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/PasswordCompositionRequirements.cs @@ -33,7 +33,7 @@ public PasswordCompositionRequirements() /// Publication 800-63-3. /// [IgnoreDataMember] - public static PasswordCompositionRequirements Nist800633 => new PasswordCompositionRequirements() + public static PasswordCompositionRequirements Nist800633 => new() { ForbidCommonBreachedPasswords = true, MinimumLowercaseAlphabeticCharacterCount = 0, @@ -47,7 +47,7 @@ public PasswordCompositionRequirements() /// Gets a that specifies no requirements. /// [IgnoreDataMember] - public static PasswordCompositionRequirements None => new PasswordCompositionRequirements() + public static PasswordCompositionRequirements None => new() { ForbidCommonBreachedPasswords = false, MinimumLowercaseAlphabeticCharacterCount = 0, @@ -62,7 +62,7 @@ public PasswordCompositionRequirements() /// character in every category and forbids commonly breached passwords. /// [IgnoreDataMember] - public static PasswordCompositionRequirements Strict => new PasswordCompositionRequirements() + public static PasswordCompositionRequirements Strict => new() { ForbidCommonBreachedPasswords = true, MinimumLowercaseAlphabeticCharacterCount = 1, @@ -143,7 +143,7 @@ public Int32 MinimumUppercaseAlphabeticCharacterCount /// 2019, per the National Cyber Security Centre (NCSC). /// [IgnoreDataMember] - public static readonly IEnumerable CommonBreachedPasswords = new String[] + public static readonly IEnumerable CommonBreachedPasswords = new[] { "123456", "123456789", diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/Secret.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/Secret.cs index fd60a854..2b1c2a9c 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/Secret.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/Secret.cs @@ -699,7 +699,7 @@ public String Name /// the plaintext is empty. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Byte[] DerivedIdentityEmptyValueBytes = new Byte[] { 0xf0, 0x55, 0xcc, 0x99, 0x0f, 0xaa, 0x33, 0x66 }; + private static readonly Byte[] DerivedIdentityEmptyValueBytes = { 0xf0, 0x55, 0xcc, 0x99, 0x0f, 0xaa, 0x33, 0x66 }; /// /// Represents an array of bytes that are used in place of ciphertext bytes for producing diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretStorePersistenceVehicle.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretStorePersistenceVehicle.cs index 55c7b6d7..96fda726 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretStorePersistenceVehicle.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretStorePersistenceVehicle.cs @@ -180,13 +180,13 @@ private static SymmetricKey InitializeObscurityKey() /// instances. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Lazy LazyObscurityKey = new Lazy(InitializeObscurityKey, LazyThreadSafetyMode.ExecutionAndPublication); + private static readonly Lazy LazyObscurityKey = new(InitializeObscurityKey, LazyThreadSafetyMode.ExecutionAndPublication); /// /// Represents the lazily-initialized password from which is derived. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Lazy LazyObscurityPassword = new Lazy(InitializeObscurityPassword, LazyThreadSafetyMode.ExecutionAndPublication); + private static readonly Lazy LazyObscurityPassword = new(InitializeObscurityPassword, LazyThreadSafetyMode.ExecutionAndPublication); /// /// Represents the that is used to encrypt and decrypt persisted state objects. @@ -198,7 +198,7 @@ private static SymmetricKey InitializeObscurityKey() /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretVault.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretVault.cs index 0399ac02..9f33b886 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretVault.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/SecretVault.cs @@ -74,7 +74,7 @@ public SecretVault(IPassword masterPassword) public SecretVault(String semanticIdentity) : base() { - LazyReferenceManager = new Lazy(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); + LazyReferenceManager = new(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); Secrets = new Dictionary(); SemanticIdentity = semanticIdentity.IsNullOrEmpty() ? Secret.NewRandomSemanticIdentifier() : semanticIdentity.RejectIf().DoesNotMatchRegularExpression(SemanticIdentityRegularExpression, nameof(semanticIdentity)); } diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/SymmetricKeySecret.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/SymmetricKeySecret.cs index 1d2a1dd8..ac9abda3 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/SymmetricKeySecret.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/SymmetricKeySecret.cs @@ -121,7 +121,7 @@ protected sealed override IReadOnlyPinnedMemory ConvertValueToBytes(Symmet { secureMemory.Access(memory => { - result = new ReadOnlyPinnedMemory(memory.ToArray()); + result = new(memory.ToArray()); }); } diff --git a/src/RapidField.SolidInstruments.Cryptography/Secrets/X509CertificateSecret.cs b/src/RapidField.SolidInstruments.Cryptography/Secrets/X509CertificateSecret.cs index 1e4393ae..96170cb9 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Secrets/X509CertificateSecret.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Secrets/X509CertificateSecret.cs @@ -92,7 +92,7 @@ public static X509CertificateSecret FromValue(String name, X509Certificate2 valu /// /// The resulting . /// - protected sealed override X509Certificate2 ConvertBytesToValue(IReadOnlyPinnedMemory bytes, IConcurrencyControlToken controlToken) => new X509Certificate2(bytes.ToArray()); + protected sealed override X509Certificate2 ConvertBytesToValue(IReadOnlyPinnedMemory bytes, IConcurrencyControlToken controlToken) => new(bytes.ToArray()); /// /// Gets the bytes of , pins them in memory and returns the resulting diff --git a/src/RapidField.SolidInstruments.Cryptography/SecureMemory.cs b/src/RapidField.SolidInstruments.Cryptography/SecureMemory.cs index 7f727e3a..2b56aba2 100644 --- a/src/RapidField.SolidInstruments.Cryptography/SecureMemory.cs +++ b/src/RapidField.SolidInstruments.Cryptography/SecureMemory.cs @@ -37,7 +37,7 @@ public SecureMemory(Int32 lengthInBytes) { Cipher = new Aes128CbcCipher(RandomnessProvider); LengthInBytes = lengthInBytes.RejectIf().IsLessThanOrEqualTo(0, nameof(lengthInBytes)); - PrivateKeySourceField = new InflatedField(PrivateKeySourceLengthInBytes, PrivateKeySourceFieldMultiplier, RandomnessProvider); + PrivateKeySourceField = new(PrivateKeySourceLengthInBytes, PrivateKeySourceFieldMultiplier, RandomnessProvider); PrivateKeySourceBitShiftDirection = RandomnessProvider.GetBoolean() ? BitShiftDirection.Left : BitShiftDirection.Right; PrivateKeySourceBitShiftCount = BitConverter.GetBytes(RandomnessProvider.GetUInt16()).Max(); PrivateKeyVersionValue = 0; @@ -48,7 +48,7 @@ public SecureMemory(Int32 lengthInBytes) using var plaintext = new PinnedMemory(lengthInBytes); using var privateKey = DerivePrivateKey(PrivateKeySource, PrivateKeySourceBitShiftDirection, PrivateKeySourceBitShiftCount, Cipher.KeySizeInBytes); using var ciphertext = Cipher.Encrypt(plaintext, privateKey, initializationVector); - CiphertextField = new InflatedField(ciphertext.Length, CiphertextFieldMultiplier, RandomnessProvider); + CiphertextField = new(ciphertext.Length, CiphertextFieldMultiplier, RandomnessProvider); ciphertext.ReadOnlySpan.CopyTo(Ciphertext); } @@ -251,7 +251,7 @@ protected override void Dispose(Boolean disposing) /// [DebuggerHidden] [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static PinnedMemory DerivePrivateKey(Byte[] privateKeySource, BitShiftDirection bitShiftDirection, Int32 bitShiftCount, Int32 keyLengthInBytes) => new PinnedMemory(new Span(privateKeySource.PerformCircularBitShift(bitShiftDirection, bitShiftCount)).Slice(0, keyLengthInBytes).ToArray(), true); + private static PinnedMemory DerivePrivateKey(Byte[] privateKeySource, BitShiftDirection bitShiftDirection, Int32 bitShiftCount, Int32 keyLengthInBytes) => new(new Span(privateKeySource.PerformCircularBitShift(bitShiftDirection, bitShiftCount)).Slice(0, keyLengthInBytes).ToArray(), true); /// /// Decrypts the current bit field and writes the result to the specified bit field. diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs index 6ab504e3..399ebe21 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/CascadingSymmetricKey.cs @@ -243,7 +243,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) } }); - return new CascadingSymmetricKey(keys); + return new(keys); } catch { @@ -263,7 +263,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) /// A new . /// [DebuggerHidden] - public static CascadingSymmetricKey New() => new CascadingSymmetricKey(DefaultDerivationMode, DefaultFirstLayerAlgorithm, DefaultSecondLayerAlgorithm); + public static CascadingSymmetricKey New() => new(DefaultDerivationMode, DefaultFirstLayerAlgorithm, DefaultSecondLayerAlgorithm); /// /// Generates a new . @@ -287,7 +287,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) /// more algorithm layers are equal to . /// [DebuggerHidden] - public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm) => new CascadingSymmetricKey(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm); + public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm) => new(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm); /// /// Generates a new . @@ -312,7 +312,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) /// more algorithm layers are equal to . /// [DebuggerHidden] - public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm, SymmetricAlgorithmSpecification thirdLayerAlgorithm) => new CascadingSymmetricKey(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm, thirdLayerAlgorithm); + public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm, SymmetricAlgorithmSpecification thirdLayerAlgorithm) => new(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm, thirdLayerAlgorithm); /// /// Generates a new . @@ -340,7 +340,7 @@ public static CascadingSymmetricKey FromSecureMemory(ISecureMemory secureMemory) /// more algorithm layers are equal to . /// [DebuggerHidden] - public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm, SymmetricAlgorithmSpecification thirdLayerAlgorithm, SymmetricAlgorithmSpecification fourthLayerAlgorithm) => new CascadingSymmetricKey(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm, thirdLayerAlgorithm, fourthLayerAlgorithm); + public static CascadingSymmetricKey New(CryptographicKeyDerivationMode derivationMode, SymmetricAlgorithmSpecification firstLayerAlgorithm, SymmetricAlgorithmSpecification secondLayerAlgorithm, SymmetricAlgorithmSpecification thirdLayerAlgorithm, SymmetricAlgorithmSpecification fourthLayerAlgorithm) => new(derivationMode, firstLayerAlgorithm, secondLayerAlgorithm, thirdLayerAlgorithm, fourthLayerAlgorithm); /// /// Releases all resources consumed by the current . @@ -469,7 +469,7 @@ private static CascadingSymmetricKey FromPassword(IPassword password, Cryptograp } } - return new CascadingSymmetricKey(keys); + return new(keys); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/EncryptedModel.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/EncryptedModel.cs index 98f5872d..d2d6f614 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/EncryptedModel.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/EncryptedModel.cs @@ -97,7 +97,7 @@ internal EncryptedModel(Byte[] ciphertext) /// /// A serializable representation of the current . /// - public EncryptedModel ToSerializableModel() => new EncryptedModel(CiphertextBytes, ModelType); + public EncryptedModel ToSerializableModel() => new(CiphertextBytes, ModelType); } /// diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKey.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKey.cs index 0f980959..fecedc7b 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKey.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKey.cs @@ -178,7 +178,7 @@ public static SymmetricKey FromSecureMemory(ISecureMemory secureMemory) Array.Copy(plaintextBuffer, KeySourceSecureMemoryIndex, keySource, 0, KeySourceLengthInBytes); var algorithm = (SymmetricAlgorithmSpecification)plaintextBuffer[AlgorithmSecureMemoryIndex]; var derivationMode = (CryptographicKeyDerivationMode)plaintextBuffer[DerivationModeSecureMemoryIndex]; - key = new SymmetricKey(algorithm, derivationMode, keySource); + key = new(algorithm, derivationMode, keySource); } } }); @@ -349,7 +349,7 @@ internal static SymmetricKey FromKeyMaterial(Byte[] keyMaterial, SymmetricAlgori /// is equal to . /// [DebuggerHidden] - internal static SymmetricKey New(SymmetricAlgorithmSpecification algorithm, CryptographicKeyDerivationMode derivationMode, PinnedMemory keySource) => new SymmetricKey(algorithm, derivationMode, keySource.RejectIf(argument => argument.Length != KeySourceLengthInBytes, nameof(keySource), $"The key source is not {KeySourceLengthInBytes} bytes in length.")); + internal static SymmetricKey New(SymmetricAlgorithmSpecification algorithm, CryptographicKeyDerivationMode derivationMode, PinnedMemory keySource) => new(algorithm, derivationMode, keySource.RejectIf(argument => argument.Length != KeySourceLengthInBytes, nameof(keySource), $"The key source is not {KeySourceLengthInBytes} bytes in length.")); /// /// Releases all resources consumed by the current . diff --git a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs index 823efbd5..16d4fee2 100644 --- a/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs +++ b/src/RapidField.SolidInstruments.Cryptography/Symmetric/SymmetricKeyCipher.cs @@ -180,7 +180,7 @@ private PinnedMemory DecryptInCbcMode(PinnedMemory ciphertext, PinnedMemory priv { cryptographicStream.Write(cipherTextSansInitializationVector, 0, cipherTextSansInitializationVector.Length); cryptographicStream.FlushFinalBlock(); - return new PinnedMemory(memoryStream.ToArray(), false); + return new(memoryStream.ToArray(), false); } } } @@ -220,7 +220,7 @@ private PinnedMemory DecryptInEcbMode(PinnedMemory ciphertext, PinnedMemory priv { cryptographicStream.Write(ciphertext, 0, ciphertext.Length); cryptographicStream.FlushFinalBlock(); - return new PinnedMemory(memoryStream.ToArray(), false); + return new(memoryStream.ToArray(), false); } } } @@ -270,7 +270,7 @@ private PinnedMemory EncryptInCbcMode(PinnedMemory plaintext, PinnedMemory priva { cryptographicStream.Write(plaintext, 0, plaintext.Length); cryptographicStream.FlushFinalBlock(); - return new PinnedMemory(initializationVector.Concat(memoryStream.ToArray()).ToArray(), false); + return new(initializationVector.Concat(memoryStream.ToArray()).ToArray(), false); } } } @@ -308,7 +308,7 @@ private PinnedMemory EncryptInEcbMode(PinnedMemory plaintext, PinnedMemory priva { cryptographicStream.Write(plaintext, 0, plaintext.Length); cryptographicStream.FlushFinalBlock(); - return new PinnedMemory(memoryStream.ToArray(), false); + return new(memoryStream.ToArray(), false); } } } diff --git a/src/RapidField.SolidInstruments.EventAuthoring/Extensions/IEventRegisterExtensions.cs b/src/RapidField.SolidInstruments.EventAuthoring/Extensions/IEventRegisterExtensions.cs index b15849f4..c9049025 100644 --- a/src/RapidField.SolidInstruments.EventAuthoring/Extensions/IEventRegisterExtensions.cs +++ b/src/RapidField.SolidInstruments.EventAuthoring/Extensions/IEventRegisterExtensions.cs @@ -28,7 +28,7 @@ public static class IEventRegisterExtensions /// /// is . /// - public static ErrorEvent Error(this IEventRegister target, Exception exception) => new ErrorEvent(exception); + public static ErrorEvent Error(this IEventRegister target, Exception exception) => new(exception); /// /// Creates a new . @@ -51,7 +51,7 @@ public static class IEventRegisterExtensions /// /// is equal to . /// - public static ErrorEvent Error(this IEventRegister target, Exception exception, Guid correlationIdentifier) => new ErrorEvent(exception, correlationIdentifier); + public static ErrorEvent Error(this IEventRegister target, Exception exception, Guid correlationIdentifier) => new(exception, correlationIdentifier); /// /// Creates a new . @@ -75,7 +75,7 @@ public static class IEventRegisterExtensions /// is -or- is /// . /// - public static ErrorEvent Error(this IEventRegister target, String applicationIdentity, Exception exception) => new ErrorEvent(applicationIdentity, exception); + public static ErrorEvent Error(this IEventRegister target, String applicationIdentity, Exception exception) => new(applicationIdentity, exception); /// /// Creates a new . @@ -105,7 +105,7 @@ public static class IEventRegisterExtensions /// /// is equal to . /// - public static ErrorEvent Error(this IEventRegister target, String applicationIdentity, Exception exception, Guid correlationIdentifier) => new ErrorEvent(applicationIdentity, exception, correlationIdentifier); + public static ErrorEvent Error(this IEventRegister target, String applicationIdentity, Exception exception, Guid correlationIdentifier) => new(applicationIdentity, exception, correlationIdentifier); /// /// Creates a new . @@ -122,7 +122,7 @@ public static class IEventRegisterExtensions /// /// is . /// - public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels) => new GeneralInformationEvent(labels); + public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels) => new(labels); /// /// Creates a new . @@ -145,7 +145,7 @@ public static class IEventRegisterExtensions /// /// is equal to . /// - public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity) => new GeneralInformationEvent(labels, verbosity); + public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity) => new(labels, verbosity); /// /// Creates a new . @@ -171,7 +171,7 @@ public static class IEventRegisterExtensions /// /// is equal to . /// - public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity, String description) => new GeneralInformationEvent(labels, verbosity, description); + public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity, String description) => new(labels, verbosity, description); /// /// Creates a new . @@ -201,6 +201,6 @@ public static class IEventRegisterExtensions /// is equal to -or- /// is equal to . /// - public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity, String description, Guid correlationIdentifier) => new GeneralInformationEvent(labels, verbosity, description, correlationIdentifier); + public static GeneralInformationEvent GeneralInformation(this IEventRegister target, IEnumerable labels, EventVerbosity verbosity, String description, Guid correlationIdentifier) => new(labels, verbosity, description, correlationIdentifier); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainer.cs b/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainer.cs index 210e5a0f..bfbb4664 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainer.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainer.cs @@ -68,9 +68,9 @@ protected DependencyContainer(IConfiguration applicationConfiguration, IServiceI : base(applicationConfiguration) { ConfigureAction = configureAction.RejectIf().IsNull(nameof(configureAction)); - LazyReferenceManager = new Lazy(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); - LazyRootScope = new Lazy(CreateRootScope, LazyThreadSafetyMode.ExecutionAndPublication); - LazySourceContainer = new Lazy(BuildSourceContainer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyReferenceManager = new(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); + LazyRootScope = new(CreateRootScope, LazyThreadSafetyMode.ExecutionAndPublication); + LazySourceContainer = new(BuildSourceContainer, LazyThreadSafetyMode.ExecutionAndPublication); ServiceInjector = serviceInjector.RejectIf().IsNull(nameof(serviceInjector)).TargetArgument; } diff --git a/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainerConfiguration.cs b/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainerConfiguration.cs index cb4ae57d..5acb40bf 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainerConfiguration.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/DependencyContainerConfiguration.cs @@ -21,7 +21,7 @@ public sealed class DependencyContainerConfiguration : Instrument public DependencyContainerConfiguration() : base() { - Configurator = new TConfigurator(); + Configurator = new(); } /// diff --git a/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs b/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs index 88674197..a786eab4 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/DependencyEngine.cs @@ -45,7 +45,7 @@ public abstract class DependencyEngine : Depend protected DependencyEngine(IConfiguration applicationConfiguration, IDependencyPackage package, IServiceCollection serviceDescriptors) : base(applicationConfiguration, package) { - LazyProviderFactory = new Lazy(CreateProviderFactory, LazyThreadSafetyMode.ExecutionAndPublication); + LazyProviderFactory = new(CreateProviderFactory, LazyThreadSafetyMode.ExecutionAndPublication); ServiceDescriptors = serviceDescriptors.RejectIf().IsNull(nameof(serviceDescriptors)).TargetArgument; } @@ -177,7 +177,7 @@ protected DependencyEngine(IConfiguration applicationConfiguration, IDependencyP { ApplicationConfiguration = applicationConfiguration.RejectIf().IsNull(nameof(applicationConfiguration)).TargetArgument; ConfigureContainerAction = (configuration, configurator) => ConfigureContainer(configuration, configurator); - LazyServiceInjector = new Lazy>(CreateServiceInjector, LazyThreadSafetyMode.ExecutionAndPublication); + LazyServiceInjector = new(CreateServiceInjector, LazyThreadSafetyMode.ExecutionAndPublication); Package = package.RejectIf().IsNull(nameof(package)).TargetArgument; } @@ -343,8 +343,8 @@ public abstract class DependencyEngine : Instrument, IDependencyEngine protected DependencyEngine() : base() { - LazyContainer = new Lazy(CreateContainer, LazyThreadSafetyMode.ExecutionAndPublication); - LazyProvider = new Lazy(CreateProvider, LazyThreadSafetyMode.ExecutionAndPublication); + LazyContainer = new(CreateContainer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyProvider = new(CreateProvider, LazyThreadSafetyMode.ExecutionAndPublication); } /// diff --git a/src/RapidField.SolidInstruments.InversionOfControl/DependencyScope.cs b/src/RapidField.SolidInstruments.InversionOfControl/DependencyScope.cs index f6fb4c97..b8d65b9b 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/DependencyScope.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/DependencyScope.cs @@ -35,7 +35,7 @@ public abstract class DependencyScope : Instrument, IDependencyScope protected DependencyScope(TScope sourceScope) : base() { - LazyReferenceManager = new Lazy(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); + LazyReferenceManager = new(() => new ReferenceManager(), LazyThreadSafetyMode.ExecutionAndPublication); SourceScope = sourceScope.RejectIf().IsNull(nameof(sourceScope)); } diff --git a/src/RapidField.SolidInstruments.InversionOfControl/Extensions/IServiceCollectionExtensions.cs b/src/RapidField.SolidInstruments.InversionOfControl/Extensions/IServiceCollectionExtensions.cs index bf3176c1..d691d5a6 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/Extensions/IServiceCollectionExtensions.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/Extensions/IServiceCollectionExtensions.cs @@ -118,6 +118,6 @@ internal static IServiceCollection AddDependencyPackage class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.InversionOfControl/ServiceScope.cs b/src/RapidField.SolidInstruments.InversionOfControl/ServiceScope.cs index 95cd9d1f..0f28a942 100644 --- a/src/RapidField.SolidInstruments.InversionOfControl/ServiceScope.cs +++ b/src/RapidField.SolidInstruments.InversionOfControl/ServiceScope.cs @@ -28,7 +28,7 @@ public sealed class ServiceScope : Instrument, IServiceScope public ServiceScope(IDependencyScope dependencyScope) { DependencyScope = dependencyScope.RejectIf().IsNull(nameof(dependencyScope)).TargetArgument; - LazyProvider = new Lazy(() => DependencyScope.Resolve(), LazyThreadSafetyMode.ExecutionAndPublication); + LazyProvider = new(() => DependencyScope.Resolve(), LazyThreadSafetyMode.ExecutionAndPublication); } /// diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs index 63c73e98..259b7be9 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Area.cs @@ -48,7 +48,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of acres. /// - public static Area FromAcres(Decimal value) => new Area(value / AcresPerSquareMeter); + public static Area FromAcres(Decimal value) => new(value / AcresPerSquareMeter); /// /// Returns an that represents the specified number of hectares. @@ -58,7 +58,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of hectares. /// - public static Area FromHectares(Decimal value) => new Area(value / HectaresPerSquareMeter); + public static Area FromHectares(Decimal value) => new(value / HectaresPerSquareMeter); /// /// Returns an that represents the specified number of square centimeters. @@ -68,7 +68,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square centimeters. /// - public static Area FromSquareCentimeters(Decimal value) => new Area(value / SquareCentimetersPerSquareMeter); + public static Area FromSquareCentimeters(Decimal value) => new(value / SquareCentimetersPerSquareMeter); /// /// Returns an that represents the specified number of square feet. @@ -78,7 +78,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square feet. /// - public static Area FromSquareFeet(Decimal value) => new Area(value / SquareFeetPerSquareMeter); + public static Area FromSquareFeet(Decimal value) => new(value / SquareFeetPerSquareMeter); /// /// Returns an that represents the specified number of square inches. @@ -88,7 +88,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square inches. /// - public static Area FromSquareInches(Decimal value) => new Area(value / SquareInchesPerSquareMeter); + public static Area FromSquareInches(Decimal value) => new(value / SquareInchesPerSquareMeter); /// /// Returns an that represents the specified number of square kilometers. @@ -98,7 +98,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square kilometers. /// - public static Area FromSquareKilometers(Decimal value) => new Area(value / SquareKilometersPerSquareMeter); + public static Area FromSquareKilometers(Decimal value) => new(value / SquareKilometersPerSquareMeter); /// /// Returns an that represents the specified number of square meters. @@ -108,7 +108,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square meters. /// - public static Area FromSquareMeters(Decimal value) => new Area(value); + public static Area FromSquareMeters(Decimal value) => new(value); /// /// Returns an that represents the specified number of square miles. @@ -118,7 +118,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square miles. /// - public static Area FromSquareMiles(Decimal value) => new Area(value / SquareMilesPerSquareMeter); + public static Area FromSquareMiles(Decimal value) => new(value / SquareMilesPerSquareMeter); /// /// Returns an that represents the specified number of square millimeters. @@ -128,7 +128,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square millimeters. /// - public static Area FromSquareMillimeters(Decimal value) => new Area(value / SquareMillimetersPerSquareMeter); + public static Area FromSquareMillimeters(Decimal value) => new(value / SquareMillimetersPerSquareMeter); /// /// Returns an that represents the specified number of square yards. @@ -138,7 +138,7 @@ public Area(Decimal squareMeters) /// /// Returns an that represents the specified number of square yards. /// - public static Area FromSquareYards(Decimal value) => new Area(value / SquareYardsPerSquareMeter); + public static Area FromSquareYards(Decimal value) => new(value / SquareYardsPerSquareMeter); /// /// Determines the difference between two values. @@ -152,7 +152,7 @@ public Area(Decimal squareMeters) /// /// The area between the specified instances. /// - public static Area operator -(Area subtrahend, Area minuend) => new Area(subtrahend.SquareMeters - minuend.SquareMeters); + public static Area operator -(Area subtrahend, Area minuend) => new(subtrahend.SquareMeters - minuend.SquareMeters); /// /// Negates the specified value. @@ -163,7 +163,7 @@ public Area(Decimal squareMeters) /// /// The negative of the specified instance. /// - public static Area operator -(Area value) => new Area(-value.SquareMeters); + public static Area operator -(Area value) => new(-value.SquareMeters); /// /// Determines whether or not two specified instances are not equal. @@ -205,7 +205,7 @@ public Area(Decimal squareMeters) /// /// The product of the specified and the specified multiplier. /// - public static Area operator *(Area multiplicand, Decimal multiplier) => new Area(multiplicand.SquareMeters * multiplier); + public static Area operator *(Area multiplicand, Decimal multiplier) => new(multiplicand.SquareMeters * multiplier); /// /// Determines the quotient of an value and a divisor. @@ -233,7 +233,7 @@ public Area(Decimal squareMeters) /// /// The quotient of the specified and the specified divisor. /// - public static Area operator /(Area dividend, Decimal divisor) => new Area(dividend.SquareMeters / divisor); + public static Area operator /(Area dividend, Decimal divisor) => new(dividend.SquareMeters / divisor); /// /// Determines the sum of two values. @@ -247,7 +247,7 @@ public Area(Decimal squareMeters) /// /// The sum of the specified instances. /// - public static Area operator +(Area augend, Area addend) => new Area(augend.SquareMeters + addend.SquareMeters); + public static Area operator +(Area augend, Area addend) => new(augend.SquareMeters + addend.SquareMeters); /// /// Determines whether or not a supplied instance is less than another supplied instance. @@ -685,7 +685,7 @@ private static Boolean Parse(String input, out Area result, Boolean raiseExcepti /// /// Represents the zero value. /// - public static readonly Area Zero = new Area(0m); + public static readonly Area Zero = new(0m); /// /// Represents the number of acres in a square meter. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs index 8f20153d..36d2c89c 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/GeographicCoordinates.cs @@ -91,7 +91,7 @@ public GeographicCoordinates(Double latitude, Double longitude) public static GeographicCoordinates Parse(String input) { Parse(input, out var latitude, out var longitude); - return new GeographicCoordinates(latitude, longitude); + return new(latitude, longitude); } /// @@ -228,12 +228,12 @@ private static void Parse(String input, out Double latitude, out Double longitud /// /// Represents geographic coordinates for Earth's North Pole. /// - public static readonly GeographicCoordinates NorthPole = new GeographicCoordinates(90d, 0d); + public static readonly GeographicCoordinates NorthPole = new(90d, 0d); /// /// Represents geographic coordinates for Earth's South Pole. /// - public static readonly GeographicCoordinates SouthPole = new GeographicCoordinates(-90d, 0d); + public static readonly GeographicCoordinates SouthPole = new(-90d, 0d); /// /// Represents the latitude element of the current . diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs index ebfc9069..cbed50cb 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Length.cs @@ -48,7 +48,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of centimeters. /// - public static Length FromCentimeters(Decimal value) => new Length(value / CentimetersPerMeter); + public static Length FromCentimeters(Decimal value) => new(value / CentimetersPerMeter); /// /// Returns a that represents the specified number of feet. @@ -58,7 +58,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of feet. /// - public static Length FromFeet(Decimal value) => new Length(value / FeetPerMeter); + public static Length FromFeet(Decimal value) => new(value / FeetPerMeter); /// /// Returns a that represents the specified number of inches. @@ -68,7 +68,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of inches. /// - public static Length FromInches(Decimal value) => new Length(value / InchesPerMeter); + public static Length FromInches(Decimal value) => new(value / InchesPerMeter); /// /// Returns a that represents the specified number of kilometers. @@ -78,7 +78,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of kilometers. /// - public static Length FromKilometers(Decimal value) => new Length(value / KilometersPerMeter); + public static Length FromKilometers(Decimal value) => new(value / KilometersPerMeter); /// /// Returns a that represents the specified number of light-years. @@ -88,7 +88,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of light-years. /// - public static Length FromLightYears(Decimal value) => new Length(value / LightYearsPerMeter); + public static Length FromLightYears(Decimal value) => new(value / LightYearsPerMeter); /// /// Returns a that represents the specified number of meters. @@ -98,7 +98,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of meters. /// - public static Length FromMeters(Decimal value) => new Length(value); + public static Length FromMeters(Decimal value) => new(value); /// /// Returns a that represents the specified number of miles. @@ -108,7 +108,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of miles. /// - public static Length FromMiles(Decimal value) => new Length(value / MilesPerMeter); + public static Length FromMiles(Decimal value) => new(value / MilesPerMeter); /// /// Returns a that represents the specified number of millimeters. @@ -118,7 +118,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of millimeters. /// - public static Length FromMillimeters(Decimal value) => new Length(value / MillimetersPerMeter); + public static Length FromMillimeters(Decimal value) => new(value / MillimetersPerMeter); /// /// Returns a that represents the specified number of nanometers. @@ -128,7 +128,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of nanometers. /// - public static Length FromNanometers(Decimal value) => new Length(value / NanometersPerMeter); + public static Length FromNanometers(Decimal value) => new(value / NanometersPerMeter); /// /// Returns a that represents the specified number of yards. @@ -138,7 +138,7 @@ public Length(Decimal meters) /// /// Returns a that represents the specified number of yards. /// - public static Length FromYards(Decimal value) => new Length(value / YardsPerMeter); + public static Length FromYards(Decimal value) => new(value / YardsPerMeter); /// /// Determines the difference between two values. @@ -152,7 +152,7 @@ public Length(Decimal meters) /// /// The distance between the specified instances. /// - public static Length operator -(Length subtrahend, Length minuend) => new Length(subtrahend.Meters - minuend.Meters); + public static Length operator -(Length subtrahend, Length minuend) => new(subtrahend.Meters - minuend.Meters); /// /// Negates the specified value. @@ -163,7 +163,7 @@ public Length(Decimal meters) /// /// The negative of the specified instance. /// - public static Length operator -(Length value) => new Length(-value.Meters); + public static Length operator -(Length value) => new(-value.Meters); /// /// Determines whether or not two specified instances are not equal. @@ -205,7 +205,7 @@ public Length(Decimal meters) /// /// The product of the specified and the specified multiplier. /// - public static Length operator *(Length multiplicand, Decimal multiplier) => new Length(multiplicand.Meters * multiplier); + public static Length operator *(Length multiplicand, Decimal multiplier) => new(multiplicand.Meters * multiplier); /// /// Determines the quotient of a value and a divisor. @@ -233,7 +233,7 @@ public Length(Decimal meters) /// /// The quotient of the specified and the specified divisor. /// - public static Length operator /(Length dividend, Decimal divisor) => new Length(dividend.Meters / divisor); + public static Length operator /(Length dividend, Decimal divisor) => new(dividend.Meters / divisor); /// /// Determines the sum of two values. @@ -247,7 +247,7 @@ public Length(Decimal meters) /// /// The sum of the specified instances. /// - public static Length operator +(Length augend, Length addend) => new Length(augend.Meters + addend.Meters); + public static Length operator +(Length augend, Length addend) => new(augend.Meters + addend.Meters); /// /// Determines whether or not a supplied instance is less than another supplied instance. @@ -686,7 +686,7 @@ private static Boolean Parse(String input, out Length result, Boolean raiseExcep /// /// Represents the zero value. /// - public static readonly Length Zero = new Length(0m); + public static readonly Length Zero = new(0m); /// /// Represents the number of centimeters in an foot. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs index 3a5097cc..66aa62b6 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Mass.cs @@ -48,7 +48,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of centigrams. /// - public static Mass FromCentigrams(Decimal value) => new Mass(value / CentigramsPerGram); + public static Mass FromCentigrams(Decimal value) => new(value / CentigramsPerGram); /// /// Returns a that represents the specified number of grams. @@ -58,7 +58,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of grams. /// - public static Mass FromGrams(Decimal value) => new Mass(value); + public static Mass FromGrams(Decimal value) => new(value); /// /// Returns a that represents the specified number of kilograms. @@ -68,7 +68,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of kilograms. /// - public static Mass FromKilograms(Decimal value) => new Mass(value / KilogramsPerGram); + public static Mass FromKilograms(Decimal value) => new(value / KilogramsPerGram); /// /// Returns a that represents the specified number of micro-grams. @@ -78,7 +78,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of micro-grams. /// - public static Mass FromMicrograms(Decimal value) => new Mass(value / MicrogramsPerGram); + public static Mass FromMicrograms(Decimal value) => new(value / MicrogramsPerGram); /// /// Returns a that represents the specified number of milligrams. @@ -88,7 +88,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of milligrams. /// - public static Mass FromMilligrams(Decimal value) => new Mass(value / MilligramsPerGram); + public static Mass FromMilligrams(Decimal value) => new(value / MilligramsPerGram); /// /// Returns a that represents the specified number of nanograms. @@ -98,7 +98,7 @@ public Mass(Decimal grams) /// /// Returns a that represents the specified number of nanograms. /// - public static Mass FromNanograms(Decimal value) => new Mass(value / NanogramsPerGram); + public static Mass FromNanograms(Decimal value) => new(value / NanogramsPerGram); /// /// Determines the difference between two values. @@ -112,7 +112,7 @@ public Mass(Decimal grams) /// /// The mass between the specified instances. /// - public static Mass operator -(Mass subtrahend, Mass minuend) => new Mass(subtrahend.Grams - minuend.Grams); + public static Mass operator -(Mass subtrahend, Mass minuend) => new(subtrahend.Grams - minuend.Grams); /// /// Negates the specified value. @@ -123,7 +123,7 @@ public Mass(Decimal grams) /// /// The negative of the specified instance. /// - public static Mass operator -(Mass value) => new Mass(-value.Grams); + public static Mass operator -(Mass value) => new(-value.Grams); /// /// Determines whether or not two specified instances are not equal. @@ -165,7 +165,7 @@ public Mass(Decimal grams) /// /// The product of the specified and the specified multiplier. /// - public static Mass operator *(Mass multiplicand, Decimal multiplier) => new Mass(multiplicand.Grams * multiplier); + public static Mass operator *(Mass multiplicand, Decimal multiplier) => new(multiplicand.Grams * multiplier); /// /// Determines the quotient of a value and a divisor. @@ -193,7 +193,7 @@ public Mass(Decimal grams) /// /// The quotient of the specified and the specified divisor. /// - public static Mass operator /(Mass dividend, Decimal divisor) => new Mass(dividend.Grams / divisor); + public static Mass operator /(Mass dividend, Decimal divisor) => new(dividend.Grams / divisor); /// /// Determines the sum of two values. @@ -207,7 +207,7 @@ public Mass(Decimal grams) /// /// The sum of the specified instances. /// - public static Mass operator +(Mass augend, Mass addend) => new Mass(augend.Grams + addend.Grams); + public static Mass operator +(Mass augend, Mass addend) => new(augend.Grams + addend.Grams); /// /// Determines whether or not a supplied instance is less than another supplied instance. @@ -625,7 +625,7 @@ private static Boolean Parse(String input, out Mass result, Boolean raiseExcepti /// /// Represents the zero value. /// - public static readonly Mass Zero = new Mass(0m); + public static readonly Mass Zero = new(0m); /// /// Represents the number of centigrams in a gram. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs index 2193f6a0..efb65bf6 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Temperature.cs @@ -48,7 +48,7 @@ public Temperature(Decimal degreesCelsius) /// /// Returns a that represents the specified number of degrees Fahrenheit. /// - public static Temperature FromDegreesFahrenheit(Decimal value) => new Temperature((value - 32m) * (5m / 9m)); + public static Temperature FromDegreesFahrenheit(Decimal value) => new((value - 32m) * (5m / 9m)); /// /// Returns a that represents the specified number of degrees Celsius. @@ -58,7 +58,7 @@ public Temperature(Decimal degreesCelsius) /// /// Returns a that represents the specified number of degrees Celsius. /// - public static Temperature FromDegreesCelsius(Decimal value) => new Temperature(value); + public static Temperature FromDegreesCelsius(Decimal value) => new(value); /// /// Returns a that represents the specified number of kelvins. @@ -68,7 +68,7 @@ public Temperature(Decimal degreesCelsius) /// /// Returns a that represents the specified number of kelvins. /// - public static Temperature FromKelvins(Decimal value) => new Temperature(value - 273.15m); + public static Temperature FromKelvins(Decimal value) => new(value - 273.15m); /// /// Determines the difference between two values. @@ -82,7 +82,7 @@ public Temperature(Decimal degreesCelsius) /// /// The temperature between the specified instances. /// - public static Temperature operator -(Temperature subtrahend, Temperature minuend) => new Temperature(subtrahend.DegreesCelsius - minuend.DegreesCelsius); + public static Temperature operator -(Temperature subtrahend, Temperature minuend) => new(subtrahend.DegreesCelsius - minuend.DegreesCelsius); /// /// Negates the specified value. @@ -93,7 +93,7 @@ public Temperature(Decimal degreesCelsius) /// /// The negative of the specified instance. /// - public static Temperature operator -(Temperature value) => new Temperature(-value.DegreesCelsius); + public static Temperature operator -(Temperature value) => new(-value.DegreesCelsius); /// /// Determines whether or not two specified instances are not equal. @@ -135,7 +135,7 @@ public Temperature(Decimal degreesCelsius) /// /// The product of the specified and the specified multiplier. /// - public static Temperature operator *(Temperature multiplicand, Decimal multiplier) => new Temperature(multiplicand.DegreesCelsius * multiplier); + public static Temperature operator *(Temperature multiplicand, Decimal multiplier) => new(multiplicand.DegreesCelsius * multiplier); /// /// Determines the quotient of a value and a divisor. @@ -163,7 +163,7 @@ public Temperature(Decimal degreesCelsius) /// /// The quotient of the specified and the specified divisor. /// - public static Temperature operator /(Temperature dividend, Decimal divisor) => new Temperature(dividend.DegreesCelsius / divisor); + public static Temperature operator /(Temperature dividend, Decimal divisor) => new(dividend.DegreesCelsius / divisor); /// /// Determines the sum of two values. @@ -177,7 +177,7 @@ public Temperature(Decimal degreesCelsius) /// /// The sum of the specified instances. /// - public static Temperature operator +(Temperature augend, Temperature addend) => new Temperature(augend.DegreesCelsius + addend.DegreesCelsius); + public static Temperature operator +(Temperature augend, Temperature addend) => new(augend.DegreesCelsius + addend.DegreesCelsius); /// /// Determines whether or not a supplied instance is less than another supplied instance. diff --git a/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs b/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs index df57f31a..4bd37dc8 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Physics/Volume.cs @@ -48,7 +48,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic centimeters. /// - public static Volume FromCubicCentimeters(Decimal value) => new Volume(value / CubicCentimetersPerCubicMeter); + public static Volume FromCubicCentimeters(Decimal value) => new(value / CubicCentimetersPerCubicMeter); /// /// Returns an that represents the specified number of cubic feet. @@ -58,7 +58,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic feet. /// - public static Volume FromCubicFeet(Decimal value) => new Volume(value / CubicFeetPerCubicMeter); + public static Volume FromCubicFeet(Decimal value) => new(value / CubicFeetPerCubicMeter); /// /// Returns an that represents the specified number of cubic inches. @@ -68,7 +68,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic inches. /// - public static Volume FromCubicInches(Decimal value) => new Volume(value / CubicInchesPerCubicMeter); + public static Volume FromCubicInches(Decimal value) => new(value / CubicInchesPerCubicMeter); /// /// Returns an that represents the specified number of cubic kilometers. @@ -78,7 +78,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic kilometers. /// - public static Volume FromCubicKilometers(Decimal value) => new Volume(value / CubicKilometersPerCubicMeter); + public static Volume FromCubicKilometers(Decimal value) => new(value / CubicKilometersPerCubicMeter); /// /// Returns an that represents the specified number of cubic meters. @@ -88,7 +88,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic meters. /// - public static Volume FromCubicMeters(Decimal value) => new Volume(value); + public static Volume FromCubicMeters(Decimal value) => new(value); /// /// Returns an that represents the specified number of cubic miles. @@ -98,7 +98,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic miles. /// - public static Volume FromCubicMiles(Decimal value) => new Volume(value / CubicMilesPerCubicMeter); + public static Volume FromCubicMiles(Decimal value) => new(value / CubicMilesPerCubicMeter); /// /// Returns an that represents the specified number of cubic millimeters. @@ -108,7 +108,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic millimeters. /// - public static Volume FromCubicMillimeters(Decimal value) => new Volume(value / CubicMillimetersPerCubicMeter); + public static Volume FromCubicMillimeters(Decimal value) => new(value / CubicMillimetersPerCubicMeter); /// /// Returns an that represents the specified number of cubic yards. @@ -118,7 +118,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of cubic yards. /// - public static Volume FromCubicYards(Decimal value) => new Volume(value / CubicYardsPerCubicMeter); + public static Volume FromCubicYards(Decimal value) => new(value / CubicYardsPerCubicMeter); /// /// Returns an that represents the specified number of gallons. @@ -128,7 +128,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of gallons. /// - public static Volume FromGallons(Decimal value) => new Volume(value / GallonsPerCubicMeter); + public static Volume FromGallons(Decimal value) => new(value / GallonsPerCubicMeter); /// /// Returns an that represents the specified number of liters. @@ -138,7 +138,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of liters. /// - public static Volume FromLiters(Decimal value) => new Volume(value / LitersPerCubicMeter); + public static Volume FromLiters(Decimal value) => new(value / LitersPerCubicMeter); /// /// Returns an that represents the specified number of milliliters. @@ -148,7 +148,7 @@ public Volume(Decimal cubicMeters) /// /// Returns an that represents the specified number of milliliters. /// - public static Volume FromMilliliters(Decimal value) => new Volume(value / MillilitersPerCubicMeter); + public static Volume FromMilliliters(Decimal value) => new(value / MillilitersPerCubicMeter); /// /// Determines the difference between two values. @@ -162,7 +162,7 @@ public Volume(Decimal cubicMeters) /// /// The area between the specified instances. /// - public static Volume operator -(Volume subtrahend, Volume minuend) => new Volume(subtrahend.CubicMeters - minuend.CubicMeters); + public static Volume operator -(Volume subtrahend, Volume minuend) => new(subtrahend.CubicMeters - minuend.CubicMeters); /// /// Negates the specified value. @@ -173,7 +173,7 @@ public Volume(Decimal cubicMeters) /// /// The negative of the specified instance. /// - public static Volume operator -(Volume value) => new Volume(-value.CubicMeters); + public static Volume operator -(Volume value) => new(-value.CubicMeters); /// /// Determines whether or not two specified instances are not equal. @@ -215,7 +215,7 @@ public Volume(Decimal cubicMeters) /// /// The product of the specified and the specified multiplier. /// - public static Volume operator *(Volume multiplicand, Decimal multiplier) => new Volume(multiplicand.CubicMeters * multiplier); + public static Volume operator *(Volume multiplicand, Decimal multiplier) => new(multiplicand.CubicMeters * multiplier); /// /// Determines the quotient of an value and a divisor. @@ -243,7 +243,7 @@ public Volume(Decimal cubicMeters) /// /// The quotient of the specified and the specified divisor. /// - public static Volume operator /(Volume dividend, Decimal divisor) => new Volume(dividend.CubicMeters / divisor); + public static Volume operator /(Volume dividend, Decimal divisor) => new(dividend.CubicMeters / divisor); /// /// Determines the sum of two values. @@ -257,7 +257,7 @@ public Volume(Decimal cubicMeters) /// /// The sum of the specified instances. /// - public static Volume operator +(Volume augend, Volume addend) => new Volume(augend.CubicMeters + addend.CubicMeters); + public static Volume operator +(Volume augend, Volume addend) => new(augend.CubicMeters + addend.CubicMeters); /// /// Determines whether or not a supplied instance is less than another supplied instance. @@ -706,7 +706,7 @@ private static Boolean Parse(String input, out Volume result, Boolean raiseExcep /// /// Represents the zero value. /// - public static readonly Volume Zero = new Volume(0m); + public static readonly Volume Zero = new(0m); /// /// Represents the number of cubic centimeters in a cubic meter. diff --git a/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs b/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs index 354b2c8d..c93e157d 100644 --- a/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs +++ b/src/RapidField.SolidInstruments.Mathematics/Statistics/Extensions/IEnumerableExtensions.cs @@ -66,7 +66,7 @@ public static DescriptiveStatistics ComputeDescriptives(this IEnumerable var mean = target.Mean(sum); var variance = target.Variance(mean); var standardDeviation = target.StandardDeviation(variance); - return new DescriptiveStatistics(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); + return new(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); } /// @@ -118,7 +118,7 @@ public static DescriptiveStatistics ComputeDescriptives(this IEnumerable var mean = target.Mean(sum); var variance = target.Variance(mean); var standardDeviation = target.StandardDeviation(variance); - return new DescriptiveStatistics(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); + return new(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); } /// @@ -170,7 +170,7 @@ public static DescriptiveStatistics ComputeDescriptives(this IEnumerable var mean = target.Mean(sum); var variance = target.Variance(mean); var standardDeviation = target.StandardDeviation(variance); - return new DescriptiveStatistics(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); + return new(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); } /// @@ -222,7 +222,7 @@ public static DescriptiveStatistics ComputeDescriptives(this IEnumerable var mean = target.Mean(sum); var variance = target.Variance(mean); var standardDeviation = target.StandardDeviation(variance); - return new DescriptiveStatistics(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); + return new(size, Convert.ToDecimal(minimum), Convert.ToDecimal(maximum), Convert.ToDecimal(sum), Convert.ToDecimal(median), Convert.ToDecimal(mean), Convert.ToDecimal(variance), Convert.ToDecimal(standardDeviation)); } /// @@ -274,7 +274,7 @@ public static DescriptiveStatistics ComputeDescriptives(this IEnumerable diff --git a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusClientFactory.cs b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusClientFactory.cs index 9d09638e..44a8fd13 100644 --- a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusClientFactory.cs +++ b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusClientFactory.cs @@ -30,7 +30,7 @@ public sealed class AzureServiceBusClientFactory : MessagingClientFactory @@ -275,21 +275,21 @@ private Task EnsureTopicExistanceAsync(IMessagingEntityPath topicPath) => Task.F /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Object EnsureQueueExistenceSyncRoot = new Object(); + private static readonly Object EnsureQueueExistenceSyncRoot = new(); /// /// Represents an object that is used to synchronize access to /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Object EnsureSubscriptionExistenceSyncRoot = new Object(); + private static readonly Object EnsureSubscriptionExistenceSyncRoot = new(); /// /// Represents an object that is used to synchronize access to /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Object EnsureTopicExistenceSyncRoot = new Object(); + private static readonly Object EnsureTopicExistenceSyncRoot = new(); /// /// Represents the behavior used by clients when retrying an operation. diff --git a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs index cc2b997a..40dd41a1 100644 --- a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs +++ b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusListeningFacade.cs @@ -188,7 +188,7 @@ private static Guid ExtractCorrelationIdentifier(AzureServiceBusMessage message) /// Gets options that specify how receive clients handle messages. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static MessageHandlerOptions ReceiverOptions => new MessageHandlerOptions(HandleReceiverExceptionAsync) + private static MessageHandlerOptions ReceiverOptions => new(HandleReceiverExceptionAsync) { AutoComplete = false }; diff --git a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusMessageAdapter.cs b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusMessageAdapter.cs index aebfcdc5..f237894a 100644 --- a/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusMessageAdapter.cs +++ b/src/RapidField.SolidInstruments.Messaging.AzureServiceBus/AzureServiceBusMessageAdapter.cs @@ -55,7 +55,7 @@ public AzureServiceBusMessageAdapter(SerializationFormat messageSerializationFor /// /// The implementation-specific message. /// - protected sealed override AzureServiceBusMessage ConvertForward(TMessage message, ISerializer serializer) => new AzureServiceBusMessage() + protected sealed override AzureServiceBusMessage ConvertForward(TMessage message, ISerializer serializer) => new() { Body = serializer.Serialize(message), ContentType = MessageSerializationFormat.ToMimeMediaType(), diff --git a/src/RapidField.SolidInstruments.Messaging.InMemory/InMemoryMessageAdapter.cs b/src/RapidField.SolidInstruments.Messaging.InMemory/InMemoryMessageAdapter.cs index e6f65c43..c2697259 100644 --- a/src/RapidField.SolidInstruments.Messaging.InMemory/InMemoryMessageAdapter.cs +++ b/src/RapidField.SolidInstruments.Messaging.InMemory/InMemoryMessageAdapter.cs @@ -53,7 +53,7 @@ public InMemoryMessageAdapter(SerializationFormat messageSerializationFormat) /// /// The implementation-specific message. /// - protected sealed override PrimitiveMessage ConvertForward(TMessage message, ISerializer serializer) => new PrimitiveMessage(message, new MessageLockToken(Guid.NewGuid(), message.Identifier), MessageSerializationFormat); + protected sealed override PrimitiveMessage ConvertForward(TMessage message, ISerializer serializer) => new(message, new(Guid.NewGuid(), message.Identifier), MessageSerializationFormat); /// /// Converts the specified implementation-specific message to a general-format message. diff --git a/src/RapidField.SolidInstruments.Messaging.RabbitMq/RabbitMqMessageAdapter.cs b/src/RapidField.SolidInstruments.Messaging.RabbitMq/RabbitMqMessageAdapter.cs index 24750c68..b64cec6d 100644 --- a/src/RapidField.SolidInstruments.Messaging.RabbitMq/RabbitMqMessageAdapter.cs +++ b/src/RapidField.SolidInstruments.Messaging.RabbitMq/RabbitMqMessageAdapter.cs @@ -53,7 +53,7 @@ public RabbitMqMessageAdapter(SerializationFormat messageSerializationFormat) /// /// The implementation-specific message. /// - protected sealed override PrimitiveMessage ConvertForward(TMessage message, ISerializer serializer) => new PrimitiveMessage(message, new MessageLockToken(Guid.NewGuid(), message.Identifier), MessageSerializationFormat); + protected sealed override PrimitiveMessage ConvertForward(TMessage message, ISerializer serializer) => new(message, new(Guid.NewGuid(), message.Identifier), MessageSerializationFormat); /// /// Converts the specified implementation-specific message to a general-format message. diff --git a/src/RapidField.SolidInstruments.Messaging.RabbitMq/TransportPrimitives/RabbitMqMessageTransport.cs b/src/RapidField.SolidInstruments.Messaging.RabbitMq/TransportPrimitives/RabbitMqMessageTransport.cs index 065f42a0..b3da1c3f 100644 --- a/src/RapidField.SolidInstruments.Messaging.RabbitMq/TransportPrimitives/RabbitMqMessageTransport.cs +++ b/src/RapidField.SolidInstruments.Messaging.RabbitMq/TransportPrimitives/RabbitMqMessageTransport.cs @@ -1604,6 +1604,6 @@ public SerializationFormat MessageBodySerializationFormat /// identifier. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary ConnectionDictionary = new ConcurrentDictionary(); + private readonly ConcurrentDictionary ConnectionDictionary = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/Extensions/ICommandMessageRegisterExtensions.cs b/src/RapidField.SolidInstruments.Messaging/Extensions/ICommandMessageRegisterExtensions.cs index 75cb49bc..90bdbcfc 100644 --- a/src/RapidField.SolidInstruments.Messaging/Extensions/ICommandMessageRegisterExtensions.cs +++ b/src/RapidField.SolidInstruments.Messaging/Extensions/ICommandMessageRegisterExtensions.cs @@ -29,7 +29,7 @@ public static class ICommandMessageRegisterExtensions /// /// A new . /// - public static TextualCommandMessage FromText(this ICommandMessageRegister target, String value) => new TextualCommandMessage(target.Commands.FromText(value)); + public static TextualCommandMessage FromText(this ICommandMessageRegister target, String value) => new(target.Commands.FromText(value)); /// /// Creates a new . @@ -49,6 +49,6 @@ public static class ICommandMessageRegisterExtensions /// /// A new . /// - public static TextualCommandMessage FromText(this ICommandMessageRegister target, String value, IEnumerable labels) => new TextualCommandMessage(target.Commands.FromText(value, labels)); + public static TextualCommandMessage FromText(this ICommandMessageRegister target, String value, IEnumerable labels) => new(target.Commands.FromText(value, labels)); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/Extensions/IRequestMessageRegisterExtensions.cs b/src/RapidField.SolidInstruments.Messaging/Extensions/IRequestMessageRegisterExtensions.cs index 75cebb3e..5a3d3ce3 100644 --- a/src/RapidField.SolidInstruments.Messaging/Extensions/IRequestMessageRegisterExtensions.cs +++ b/src/RapidField.SolidInstruments.Messaging/Extensions/IRequestMessageRegisterExtensions.cs @@ -38,6 +38,6 @@ public static class IRequestMessageRegisterExtensions /// /// is equal to . /// - public static PingRequestMessage Ping(this IRequestMessageRegister target, Guid correlationIdentifier) => new PingRequestMessage(correlationIdentifier); + public static PingRequestMessage Ping(this IRequestMessageRegister target, Guid correlationIdentifier) => new(correlationIdentifier); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/MessageListeningFacade.cs b/src/RapidField.SolidInstruments.Messaging/MessageListeningFacade.cs index 9bfb44ce..32f0c194 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessageListeningFacade.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessageListeningFacade.cs @@ -355,14 +355,14 @@ internal static IEnumerable AppendDeadLetterQueueLabel(IEnumerable new String[] { pathLabels.ElementAt(0), DeadLetterQueueLabel }, - 2 => new String[] { pathLabels.ElementAt(0), pathLabels.ElementAt(1), DeadLetterQueueLabel }, - 3 => new String[] { pathLabels.ElementAt(0), pathLabels.ElementAt(1), $"{pathLabels.ElementAt(1)}{MessagingEntityPath.DelimitingCharacterForLabelTokenSubParts}{DeadLetterQueueLabel}" }, + 1 => new[] { pathLabels.ElementAt(0), DeadLetterQueueLabel }, + 2 => new[] { pathLabels.ElementAt(0), pathLabels.ElementAt(1), DeadLetterQueueLabel }, + 3 => new[] { pathLabels.ElementAt(0), pathLabels.ElementAt(1), $"{pathLabels.ElementAt(1)}{MessagingEntityPath.DelimitingCharacterForLabelTokenSubParts}{DeadLetterQueueLabel}" }, _ => throw new ArgumentException("The specified path label collection contains more than three elements.", nameof(pathLabels)), }; } diff --git a/src/RapidField.SolidInstruments.Messaging/MessageListeningFailurePolicy.cs b/src/RapidField.SolidInstruments.Messaging/MessageListeningFailurePolicy.cs index d2fc6c5e..fe7dd26d 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessageListeningFailurePolicy.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessageListeningFailurePolicy.cs @@ -137,7 +137,7 @@ public Boolean TransmitExceptionRaisedEventMessage /// /// Represents the default failure behavior. /// - public static readonly MessageListeningFailurePolicy Default = new MessageListeningFailurePolicy(); + public static readonly MessageListeningFailurePolicy Default = new(); /// /// Represents the default failure behavior that is employed after the retry policy is exhausted. diff --git a/src/RapidField.SolidInstruments.Messaging/MessageListeningRetryPolicy.cs b/src/RapidField.SolidInstruments.Messaging/MessageListeningRetryPolicy.cs index fe8c843c..c2d02c82 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessageListeningRetryPolicy.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessageListeningRetryPolicy.cs @@ -129,12 +129,12 @@ public Int32 RetryCount /// /// Represents the default retry behavior. /// - public static readonly MessageListeningRetryPolicy Default = new MessageListeningRetryPolicy(); + public static readonly MessageListeningRetryPolicy Default = new(); /// /// Represents retry behavior that instructs the listener not to retry processing for the message. /// - public static readonly MessageListeningRetryPolicy DoNotRetry = new MessageListeningRetryPolicy(0); + public static readonly MessageListeningRetryPolicy DoNotRetry = new(0); /// /// Represents the default number of seconds to wait between retries, or the duration, in seconds, from which to scale diff --git a/src/RapidField.SolidInstruments.Messaging/MessageRequestingFacade.cs b/src/RapidField.SolidInstruments.Messaging/MessageRequestingFacade.cs index 791738c8..f4b9d520 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessageRequestingFacade.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessageRequestingFacade.cs @@ -410,13 +410,13 @@ private IResponseMessage WaitForResponse(Guid requestMessageIdentifier, TimeSpan /// Represents a lazily-initialized collection of outstanding requests that key pending response messages. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Lazy> LazyOutstandingRequests = new Lazy>(() => new ConcurrentDictionary(), LazyThreadSafetyMode.ExecutionAndPublication); + private readonly Lazy> LazyOutstandingRequests = new(() => new(), LazyThreadSafetyMode.ExecutionAndPublication); /// /// Represents a lazily-initialized collection of unprocessed response messages that are keyed by request message /// identifier. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Lazy> LazyUnprocessedResponses = new Lazy>(() => new ConcurrentDictionary(), LazyThreadSafetyMode.ExecutionAndPublication); + private readonly Lazy> LazyUnprocessedResponses = new(() => new(), LazyThreadSafetyMode.ExecutionAndPublication); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/MessagingClientFactory.cs b/src/RapidField.SolidInstruments.Messaging/MessagingClientFactory.cs index 787b2037..e5d7905a 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessagingClientFactory.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessagingClientFactory.cs @@ -583,12 +583,12 @@ private TSender GetMessageSender(MessagingEntityType entityType, IEnum /// Represents a lazily-initialized collection of message receivers that are keyed by entity path. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Lazy> LazyMessageReceivers = new Lazy>(() => new Dictionary(), LazyThreadSafetyMode.ExecutionAndPublication); + private readonly Lazy> LazyMessageReceivers = new(() => new Dictionary(), LazyThreadSafetyMode.ExecutionAndPublication); /// /// Represents a lazily-initialized collection of message senders that are keyed by entity path. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Lazy> LazyMessageSenders = new Lazy>(() => new Dictionary(), LazyThreadSafetyMode.ExecutionAndPublication); + private readonly Lazy> LazyMessageSenders = new(() => new Dictionary(), LazyThreadSafetyMode.ExecutionAndPublication); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs b/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs index f402666f..d6dcc3a5 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessagingEntityPath.cs @@ -569,7 +569,7 @@ private static Boolean Parse(String input, out MessagingEntityPath result, Boole var labelOneString = matchGroups.Where(group => group.Success && group.Name == PatternGroupNameForLabelTokenOne).SingleOrDefault()?.Value; var labelTwoString = matchGroups.Where(group => group.Success && group.Name == PatternGroupNameForLabelTokenTwo).SingleOrDefault()?.Value; var labelThreeString = matchGroups.Where(group => group.Success && group.Name == PatternGroupNameForLabelTokenThree).SingleOrDefault()?.Value; - result = new MessagingEntityPath(messageTypeString, prefixString, labelOneString, labelTwoString, labelThreeString); + result = new(messageTypeString, prefixString, labelOneString, labelTwoString, labelThreeString); return true; } catch (Exception exception) diff --git a/src/RapidField.SolidInstruments.Messaging/MessagingFacade.cs b/src/RapidField.SolidInstruments.Messaging/MessagingFacade.cs index d5e4e555..07628f39 100644 --- a/src/RapidField.SolidInstruments.Messaging/MessagingFacade.cs +++ b/src/RapidField.SolidInstruments.Messaging/MessagingFacade.cs @@ -49,8 +49,8 @@ protected MessagingFacade(IMessagingClientFactory(InitializeApplicationIdentity, LazyThreadSafetyMode.ExecutionAndPublication); - LazyIdentifier = new Lazy(InitializeIdentifier, LazyThreadSafetyMode.ExecutionAndPublication); + LazyApplicationIdentity = new(InitializeApplicationIdentity, LazyThreadSafetyMode.ExecutionAndPublication); + LazyIdentifier = new(InitializeIdentifier, LazyThreadSafetyMode.ExecutionAndPublication); MessageAdapter = messageAdapter.RejectIf().IsNull(nameof(messageAdapter)).TargetArgument; } diff --git a/src/RapidField.SolidInstruments.Messaging/Service/MessageListeningProfile.cs b/src/RapidField.SolidInstruments.Messaging/Service/MessageListeningProfile.cs index 0934401a..f6721587 100644 --- a/src/RapidField.SolidInstruments.Messaging/Service/MessageListeningProfile.cs +++ b/src/RapidField.SolidInstruments.Messaging/Service/MessageListeningProfile.cs @@ -291,6 +291,6 @@ public IEnumerable SupportedMessageTypes /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly List SupportedMessageTypesReference = new List(); + private readonly List SupportedMessageTypesReference = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/Service/MessagingServiceExecutor.cs b/src/RapidField.SolidInstruments.Messaging/Service/MessagingServiceExecutor.cs index 7c6d1ff8..ff350f0c 100644 --- a/src/RapidField.SolidInstruments.Messaging/Service/MessagingServiceExecutor.cs +++ b/src/RapidField.SolidInstruments.Messaging/Service/MessagingServiceExecutor.cs @@ -100,9 +100,9 @@ protected MessagingServiceExecutor(String serviceName, Boolean runsContinuously) protected MessagingServiceExecutor(String serviceName, Boolean runsContinuously, Boolean publishesStartAndStopEvents) : base(serviceName) { - LazyHeartbeatSchedule = new Lazy(CreateHeartbeatSchedule, LazyThreadSafetyMode.ExecutionAndPublication); - LazyHeartbeatTimers = new Lazy>(() => new List(), LazyThreadSafetyMode.ExecutionAndPublication); - LazyListeningProfile = new Lazy(CreateListeningProfile, LazyThreadSafetyMode.ExecutionAndPublication); + LazyHeartbeatSchedule = new(CreateHeartbeatSchedule, LazyThreadSafetyMode.ExecutionAndPublication); + LazyHeartbeatTimers = new(() => new List(), LazyThreadSafetyMode.ExecutionAndPublication); + LazyListeningProfile = new(CreateListeningProfile, LazyThreadSafetyMode.ExecutionAndPublication); PublishesStartAndStopEvents = publishesStartAndStopEvents; RunsContinuously = runsContinuously; } diff --git a/src/RapidField.SolidInstruments.Messaging/Service/PingRequestMessageListener.cs b/src/RapidField.SolidInstruments.Messaging/Service/PingRequestMessageListener.cs index 9850d8ef..9eedc99a 100644 --- a/src/RapidField.SolidInstruments.Messaging/Service/PingRequestMessageListener.cs +++ b/src/RapidField.SolidInstruments.Messaging/Service/PingRequestMessageListener.cs @@ -53,6 +53,6 @@ public PingRequestMessageListener(ICommandMediator mediator) /// /// The result that is emitted when processing the command. /// - protected override PingResponseMessage Process(PingRequestMessage command, ICommandMediator mediator, IConcurrencyControlToken controlToken) => new PingResponseMessage(command.Identifier, command.CorrelationIdentifier); + protected override PingResponseMessage Process(PingRequestMessage command, ICommandMediator mediator, IConcurrencyControlToken controlToken) => new(command.Identifier, command.CorrelationIdentifier); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageQueue.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageQueue.cs index 22e99479..5e222995 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageQueue.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageQueue.cs @@ -373,12 +373,12 @@ protected override void Dispose(Boolean disposing) /// Represents the underlying first-in first-out collection that contains messages that are locked for processing. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary LockedMessages = new ConcurrentDictionary(); + private readonly ConcurrentDictionary LockedMessages = new(); /// /// Represents the underlying first-in first-out collection that contains enqueued messages. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentQueue Messages = new ConcurrentQueue(); + private readonly ConcurrentQueue Messages = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTopic.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTopic.cs index 66c0b784..b94d8a49 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTopic.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTopic.cs @@ -573,6 +573,6 @@ protected override void Dispose(Boolean disposing) /// subscription name. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary SubscriptionQueues = new ConcurrentDictionary(); + private readonly ConcurrentDictionary SubscriptionQueues = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransport.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransport.cs index eaf55a23..64cb97a7 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransport.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransport.cs @@ -1224,31 +1224,31 @@ public SerializationFormat MessageBodySerializationFormat /// Represents a lazily-initialized in-memory instance. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Lazy LazyInstance = new Lazy(InitializeInstance, LazyThreadSafetyMode.ExecutionAndPublication); + private static readonly Lazy LazyInstance = new(InitializeInstance, LazyThreadSafetyMode.ExecutionAndPublication); /// /// Represents a finalizer for static members of the class. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly StaticMemberFinalizer StaticMemberFinalizer = new StaticMemberFinalizer(FinalizeStaticMembers); + private static readonly StaticMemberFinalizer StaticMemberFinalizer = new(FinalizeStaticMembers); /// /// Represents a collection of active connections to the current , which are keyed by /// identifier. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary ConnectionDictionary = new ConcurrentDictionary(); + private readonly ConcurrentDictionary ConnectionDictionary = new(); /// /// Represents a collection of available queues for the current . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary QueueDictionary = new ConcurrentDictionary(); + private readonly ConcurrentDictionary QueueDictionary = new(); /// /// Represents a collection of available topics for the current . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly ConcurrentDictionary TopicDictionary = new ConcurrentDictionary(); + private readonly ConcurrentDictionary TopicDictionary = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransportConnection.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransportConnection.cs index 330245ed..93ac8a98 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransportConnection.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessageTransportConnection.cs @@ -37,7 +37,7 @@ internal MessageTransportConnection(IMessageTransport transport) { Handlers = new List(); Identifier = Guid.NewGuid(); - LazyPollTimer = new Lazy(InitializePollTimer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyPollTimer = new(InitializePollTimer, LazyThreadSafetyMode.ExecutionAndPublication); State = MessageTransportConnectionState.Open; TransportReference = transport.RejectIf().IsNull(nameof(transport)).TargetArgument; } @@ -189,7 +189,7 @@ private void BeginPolling() private Timer InitializePollTimer() { var timerCallback = new TimerCallback((state) => Poll(state as ICollection)); - return new Timer(timerCallback, Handlers, TimeSpan.FromMilliseconds(PollingIntervalInMilliseconds), TimeSpan.FromMilliseconds(PollingIntervalInMilliseconds)); + return new(timerCallback, Handlers, TimeSpan.FromMilliseconds(PollingIntervalInMilliseconds), TimeSpan.FromMilliseconds(PollingIntervalInMilliseconds)); } /// diff --git a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessagingEntityClient.cs b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessagingEntityClient.cs index eabb5cd5..7af9bb30 100644 --- a/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessagingEntityClient.cs +++ b/src/RapidField.SolidInstruments.Messaging/TransportPrimitives/MessagingEntityClient.cs @@ -305,20 +305,20 @@ public IMessagingEntityPath Path /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly Object EnsureQueueExistenceSyncRoot = new Object(); + internal static readonly Object EnsureQueueExistenceSyncRoot = new(); /// /// Represents an object that is used to synchronize access to /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly Object EnsureSubscriptionExistenceSyncRoot = new Object(); + internal static readonly Object EnsureSubscriptionExistenceSyncRoot = new(); /// /// Represents an object that is used to synchronize access to /// . /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static readonly Object EnsureTopicExistenceSyncRoot = new Object(); + internal static readonly Object EnsureTopicExistenceSyncRoot = new(); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs b/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs index cc4c5f39..2daabb1c 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/FactoryProducedInstanceGroup.cs @@ -92,7 +92,7 @@ public Lazy GetLazy() where T : class { RejectIfDisposed(); - return new Lazy(() => Get(), LazyThreadSafetyMode.PublicationOnly); + return new(() => Get(), LazyThreadSafetyMode.PublicationOnly); } /// diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainer.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainer.cs index b5841b12..be3fc8d4 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainer.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainer.cs @@ -108,8 +108,8 @@ private ObjectContainer(IConfiguration applicationConfiguration, IObjectFactory { DefinitionConfigurator = definitionConfigurator.RejectIf().IsNull(nameof(definitionConfigurator)); Factory = factory.RejectIf().IsNull(nameof(factory)).TargetArgument; - LazyInstanceDictionary = new Lazy>(InitializeInstanceDictionary, LazyThreadSafetyMode.ExecutionAndPublication); - LazyInstanceGroup = new Lazy(InitializeInstanceGroup, LazyThreadSafetyMode.PublicationOnly); + LazyInstanceDictionary = new(InitializeInstanceDictionary, LazyThreadSafetyMode.ExecutionAndPublication); + LazyInstanceGroup = new(InitializeInstanceGroup, LazyThreadSafetyMode.PublicationOnly); ManagesFactory = managesFactory; } @@ -422,7 +422,7 @@ private sealed class ContainerObjectFactory : ObjectFactory internal ContainerObjectFactory(IConfiguration applicationConfiguration, Action factoryConfigurator) : base(applicationConfiguration) { - FactoryConfigurator = new Action>((functions) => + FactoryConfigurator = new((functions) => { factoryConfigurator(new ObjectFactoryConfigurationProductionFunctions(functions)); }); diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerConfigurationDefinitions.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerConfigurationDefinitions.cs index ada73fca..4d730930 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerConfigurationDefinitions.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectContainerConfigurationDefinitions.cs @@ -24,7 +24,7 @@ public sealed class ObjectContainerConfigurationDefinitions : IObjectContainerCo [DebuggerHidden] internal ObjectContainerConfigurationDefinitions() { - Registrations = new ConcurrentDictionary(); + Registrations = new(); } /// diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs index 2e4f906b..ca77509f 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactory.cs @@ -102,7 +102,7 @@ protected ObjectFactory() protected ObjectFactory(IConfiguration applicationConfiguration) : base(applicationConfiguration) { - LazyProductionFunctions = new Lazy>(DefineProductionFunctions, LazyThreadSafetyMode.ExecutionAndPublication); + LazyProductionFunctions = new(DefineProductionFunctions, LazyThreadSafetyMode.ExecutionAndPublication); ProductBaseType = typeof(TProductBase); } diff --git a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactoryConfigurationProductionFunctions.cs b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactoryConfigurationProductionFunctions.cs index 62922508..6838b720 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactoryConfigurationProductionFunctions.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/ObjectFactoryConfigurationProductionFunctions.cs @@ -60,7 +60,7 @@ public class ObjectFactoryConfigurationProductionFunctions : IObje /// [DebuggerHidden] internal ObjectFactoryConfigurationProductionFunctions() - : this(new ConcurrentDictionary()) + : this(new()) { return; } diff --git a/src/RapidField.SolidInstruments.ObjectComposition/SelfComposingInstrument.cs b/src/RapidField.SolidInstruments.ObjectComposition/SelfComposingInstrument.cs index 4281fa5c..4b716bb9 100644 --- a/src/RapidField.SolidInstruments.ObjectComposition/SelfComposingInstrument.cs +++ b/src/RapidField.SolidInstruments.ObjectComposition/SelfComposingInstrument.cs @@ -22,7 +22,7 @@ public abstract class SelfComposingInstrument : Instrument protected SelfComposingInstrument() : base() { - LazyContainer = new Lazy(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyContainer = new(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); } /// @@ -38,7 +38,7 @@ protected SelfComposingInstrument() protected SelfComposingInstrument(ConcurrencyControlMode stateControlMode) : base(stateControlMode) { - LazyContainer = new Lazy(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyContainer = new(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); } /// @@ -61,7 +61,7 @@ protected SelfComposingInstrument(ConcurrencyControlMode stateControlMode) protected SelfComposingInstrument(ConcurrencyControlMode stateControlMode, TimeSpan stateControlTimeoutThreshold) : base(stateControlMode, stateControlTimeoutThreshold) { - LazyContainer = new Lazy(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); + LazyContainer = new(InitializeContainer, LazyThreadSafetyMode.ExecutionAndPublication); } /// diff --git a/src/RapidField.SolidInstruments.Serialization/DynamicSerializer.cs b/src/RapidField.SolidInstruments.Serialization/DynamicSerializer.cs index d6e1c5a2..53853762 100644 --- a/src/RapidField.SolidInstruments.Serialization/DynamicSerializer.cs +++ b/src/RapidField.SolidInstruments.Serialization/DynamicSerializer.cs @@ -46,8 +46,8 @@ public DynamicSerializer() public DynamicSerializer(SerializationFormat format) : base(format) { - LazyJsonSerializer = new Lazy(InitializeJsonSerializer, LazyThreadSafetyMode.PublicationOnly); - LazyXmlSerializer = new Lazy(InitializeXmlSerializer, LazyThreadSafetyMode.PublicationOnly); + LazyJsonSerializer = new(InitializeJsonSerializer, LazyThreadSafetyMode.PublicationOnly); + LazyXmlSerializer = new(InitializeXmlSerializer, LazyThreadSafetyMode.PublicationOnly); } /// @@ -320,9 +320,9 @@ private Byte[] SerializeToXml(T target) /// Represents settings used by the JSON serializer. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly DataContractJsonSerializerSettings JsonSerializerSettings = new DataContractJsonSerializerSettings + private static readonly DataContractJsonSerializerSettings JsonSerializerSettings = new() { - DateTimeFormat = new DateTimeFormat(DateTimeSerializationFormatString), + DateTimeFormat = new(DateTimeSerializationFormatString), EmitTypeInformation = EmitTypeInformation.AsNeeded, SerializeReadOnlyTypes = false }; @@ -331,7 +331,7 @@ private Byte[] SerializeToXml(T target) /// Represents settings used by the XML serializer. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly DataContractSerializerSettings XmlSerializerSettings = new DataContractSerializerSettings + private static readonly DataContractSerializerSettings XmlSerializerSettings = new() { PreserveObjectReferences = false, SerializeReadOnlyTypes = false diff --git a/src/RapidField.SolidInstruments.Service/ServiceExecutor.cs b/src/RapidField.SolidInstruments.Service/ServiceExecutor.cs index 7f4000cd..a757886d 100644 --- a/src/RapidField.SolidInstruments.Service/ServiceExecutor.cs +++ b/src/RapidField.SolidInstruments.Service/ServiceExecutor.cs @@ -54,9 +54,9 @@ protected ServiceExecutor(String serviceName) { CommandLineArguments = null; ExecutionLifetime = null; - LazyApplicationConfiguration = new Lazy(CreateApplicationConfiguration, LazyThreadSafetyMode.ExecutionAndPublication); - LazyDependencyEngine = new Lazy(CreateDependencyEngine, LazyThreadSafetyMode.ExecutionAndPublication); - LazyRootDependencyScope = new Lazy(DependencyEngine.Container.CreateScope, LazyThreadSafetyMode.ExecutionAndPublication); + LazyApplicationConfiguration = new(CreateApplicationConfiguration, LazyThreadSafetyMode.ExecutionAndPublication); + LazyDependencyEngine = new(CreateDependencyEngine, LazyThreadSafetyMode.ExecutionAndPublication); + LazyRootDependencyScope = new(DependencyEngine.Container.CreateScope, LazyThreadSafetyMode.ExecutionAndPublication); ReferenceManager = new ReferenceManager(); ServiceName = serviceName.Trim().RejectIf().IsNullOrEmpty(nameof(serviceName)); } diff --git a/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs b/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs index 3c48ba67..9e2a49c3 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/Base32Encoding.cs @@ -234,7 +234,7 @@ public override Int32 GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, C { var bufferArray = new Byte[byteCount + 1]; Array.Copy(bytes, byteIndex, bufferArray, 0, byteCount); - buffer = new BigInteger(bufferArray); + buffer = new(bufferArray); } var encodedCharacterCount = GetMaxCharCount(byteCount); @@ -279,7 +279,7 @@ public override Int32 GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, C /// /// Represents the default base32 encoding specification. /// - public new static readonly Base32Encoding Default = new Base32Encoding(); + public new static readonly Base32Encoding Default = new(); /// /// Represents the z-base-32 encoding specification. diff --git a/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs b/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs index 9a54d61e..feb88e43 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/EnhancedReadabilityGuid.cs @@ -166,7 +166,7 @@ public EnhancedReadabilityGuid(Guid value) /// /// does not contain a valid representation of a . /// - public static EnhancedReadabilityGuid Parse(String input) => Parse(input, out var value, true) ? new EnhancedReadabilityGuid(value) : default; + public static EnhancedReadabilityGuid Parse(String input) => Parse(input, out var value, true) ? new(value) : default; /// /// Converts the specified representation of a time of day value to its @@ -186,7 +186,7 @@ public static Boolean TryParse(String input, out EnhancedReadabilityGuid result) { if (Parse(input, out var value, false)) { - result = new EnhancedReadabilityGuid(value); + result = new(value); return true; } @@ -256,7 +256,7 @@ public override Boolean Equals(Object obj) /// /// A new instance of the structure. /// - public static EnhancedReadabilityGuid New() => new EnhancedReadabilityGuid(Guid.NewGuid()); + public static EnhancedReadabilityGuid New() => new(Guid.NewGuid()); /// /// Converts the current to an array of bytes. @@ -273,7 +273,7 @@ public override Boolean Equals(Object obj) /// /// A representation of the current . /// - public Guid ToGuid() => new Guid(Value.ToByteArray()); + public Guid ToGuid() => new(Value.ToByteArray()); /// /// Converts the value of the current to its equivalent string representation. @@ -281,7 +281,7 @@ public override Boolean Equals(Object obj) /// /// A string representation of the current . /// - public override String ToString() => new String(Encoding.GetChars(Value.ToByteArray())); + public override String ToString() => new(Encoding.GetChars(Value.ToByteArray())); /// /// Converts the specified representation of a time of day value to its @@ -334,7 +334,7 @@ private static Boolean Parse(String input, out Guid value, Boolean raiseExceptio { try { - value = new Guid(Encoding.GetBytes(lowercaseInput).Take(16).ToArray()); + value = new(Encoding.GetBytes(lowercaseInput).Take(16).ToArray()); return true; } catch (ArgumentException exception) @@ -355,7 +355,7 @@ private static Boolean Parse(String input, out Guid value, Boolean raiseExceptio return false; } - value = new Guid(Encoding.GetBytes(lowercaseInput).Take(16).ToArray()); + value = new(Encoding.GetBytes(lowercaseInput).Take(16).ToArray()); return true; } diff --git a/src/RapidField.SolidInstruments.TextEncoding/Extensions/GuidExtensions.cs b/src/RapidField.SolidInstruments.TextEncoding/Extensions/GuidExtensions.cs index 531cfa47..36c682f8 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/Extensions/GuidExtensions.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/Extensions/GuidExtensions.cs @@ -21,6 +21,6 @@ public static class GuidExtensions /// /// A representation of the current . /// - public static EnhancedReadabilityGuid ToEnhancedReadabilityGuid(this Guid target) => new EnhancedReadabilityGuid(target); + public static EnhancedReadabilityGuid ToEnhancedReadabilityGuid(this Guid target) => new(target); } } \ No newline at end of file diff --git a/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs b/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs index dd5e0d96..1f742532 100644 --- a/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs +++ b/src/RapidField.SolidInstruments.TextEncoding/HexadecimalEncoding.cs @@ -224,7 +224,7 @@ public override Int32 GetChars(Byte[] bytes, Int32 byteIndex, Int32 byteCount, C /// /// Represents the default hexadecimal encoding specification. /// - public new static readonly HexadecimalEncoding Default = new HexadecimalEncoding(); + public new static readonly HexadecimalEncoding Default = new(); /// /// Represents the number of bits in a byte. diff --git a/src/RapidField.SolidInstruments.Web/WebExecutor.cs b/src/RapidField.SolidInstruments.Web/WebExecutor.cs index 72fb8576..44dcab0d 100644 --- a/src/RapidField.SolidInstruments.Web/WebExecutor.cs +++ b/src/RapidField.SolidInstruments.Web/WebExecutor.cs @@ -432,7 +432,7 @@ protected virtual void ConfigureApplication(IApplicationBuilder application, ICo /// /// The dependency package. /// - protected virtual TDependencyPackage CreateDependencyPackage(IConfiguration applicationConfiguration) => new TDependencyPackage(); + protected virtual TDependencyPackage CreateDependencyPackage(IConfiguration applicationConfiguration) => new(); /// /// Creates the service provider factory. diff --git a/test/RapidField.SolidInstruments.Command.UnitTests/SimulatedAutofacDependencyPackage.cs b/test/RapidField.SolidInstruments.Command.UnitTests/SimulatedAutofacDependencyPackage.cs index 5aaed853..d3eed2bc 100644 --- a/test/RapidField.SolidInstruments.Command.UnitTests/SimulatedAutofacDependencyPackage.cs +++ b/test/RapidField.SolidInstruments.Command.UnitTests/SimulatedAutofacDependencyPackage.cs @@ -33,7 +33,7 @@ public SimulatedAutofacDependencyPackage() /// /// The package's dependency modules. /// - protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new IDependencyModule[] + protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new[] { new SimulatedAutofacDependencyModule(applicationConfiguration) }; diff --git a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedInstrument.cs b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedInstrument.cs index c9aa95af..cc541f62 100644 --- a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedInstrument.cs +++ b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedInstrument.cs @@ -121,7 +121,7 @@ public Boolean StateIsVolatile /// /// Represents an object that is used to synchronize access to the associated resource(s). /// - private readonly Object SyncRoot = new Object(); + private readonly Object SyncRoot = new(); /// /// Represents the present concurrency for invocations of . diff --git a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs index e5a0ee4b..ec02e7d9 100644 --- a/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs +++ b/test/RapidField.SolidInstruments.Core.UnitTests/SimulatedModel.cs @@ -147,7 +147,7 @@ public static SimulatedModel Random(RandomNumberGenerator randomnessProvider) modelCollection[i] = Random(randomnessProvider); } - return new SimulatedModel(time, integerCollection, modelCollection, stringValue); + return new(time, integerCollection, modelCollection, stringValue); } /// diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/IListExtensionsTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/IListExtensionsTests.cs index 85fbb017..d4289f57 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/IListExtensionsTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/IListExtensionsTests.cs @@ -26,7 +26,7 @@ public void ReverseStaggerSort_ShouldBeReversible_ForOddLengthTarget() // Act. target.ReverseStaggerSort(); target.ReverseStaggerSort(); - result = new String(target); + result = new(target); // Assert. result.Should().Be("ABCDEFGHI"); @@ -42,7 +42,7 @@ public void ReverseStaggerSort_ShouldNotBeReversible_ForEvenLengthTarget() // Act. target.ReverseStaggerSort(); target.ReverseStaggerSort(); - result = new String(target); + result = new(target); // Assert. result.Should().Be("GHEFCDAB"); @@ -57,7 +57,7 @@ public void ReverseStaggerSort_ShouldProduceDesiredResults_ForArrayTarget() // Act. target.ReverseStaggerSort(); - result = new String(target); + result = new(target); // Assert. result.Should().Be("BGDEFCHA"); diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/RandomNumberGeneratorExtensionsTests.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/RandomNumberGeneratorExtensionsTests.cs index 26efde7f..a87075e5 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/RandomNumberGeneratorExtensionsTests.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/Extensions/RandomNumberGeneratorExtensionsTests.cs @@ -29,7 +29,7 @@ public void FillBooleanArray_ShouldProduceDesiredResults() // Assert. array.Length.Should().Be(arrayLength); - array.Where(value => value == true).Count().Should().BeGreaterOrEqualTo(45).And.BeLessOrEqualTo(135); + array.Where(value => value).Count().Should().BeGreaterOrEqualTo(45).And.BeLessOrEqualTo(135); } } diff --git a/test/RapidField.SolidInstruments.Cryptography.UnitTests/SimulatedModel.cs b/test/RapidField.SolidInstruments.Cryptography.UnitTests/SimulatedModel.cs index 29ad5e9a..5763bc38 100644 --- a/test/RapidField.SolidInstruments.Cryptography.UnitTests/SimulatedModel.cs +++ b/test/RapidField.SolidInstruments.Cryptography.UnitTests/SimulatedModel.cs @@ -147,7 +147,7 @@ public static SimulatedModel Random(RandomNumberGenerator randomnessProvider) modelCollection[i] = Random(randomnessProvider); } - return new SimulatedModel(time, integerCollection, modelCollection, stringValue); + return new(time, integerCollection, modelCollection, stringValue); } /// diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Entities/NumberSeries.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Entities/NumberSeries.cs index 6939a746..f8a70b9c 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Entities/NumberSeries.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Entities/NumberSeries.cs @@ -92,7 +92,7 @@ internal static class Named /// Represents the Fibonacci number series. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static NumberSeries Fibonacci => new NumberSeries() + internal static NumberSeries Fibonacci => new() { Identifier = Guid.Parse("1100d8c5-a70c-4db2-833d-33638e453082"), Name = "Fibonacci" diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberExtensions.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberExtensions.cs index 5abbf612..24331af5 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberExtensions.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberExtensions.cs @@ -21,6 +21,6 @@ public static class INumberExtensions /// /// The converted object. /// - public static Number ToSimulatedDatabaseEntity(this INumber target) => new Number(target); + public static Number ToSimulatedDatabaseEntity(this INumber target) => new(target); } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesExtensions.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesExtensions.cs index 68b5ad64..a2a40d78 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesExtensions.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesExtensions.cs @@ -21,6 +21,6 @@ public static class INumberSeriesExtensions /// /// The converted object. /// - public static NumberSeries ToSimulatedDatabaseEntity(this INumberSeries target) => new NumberSeries(target); + public static NumberSeries ToSimulatedDatabaseEntity(this INumberSeries target) => new(target); } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesNumberExtensions.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesNumberExtensions.cs index a978e6e6..d1ed1a13 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesNumberExtensions.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/Extensions/INumberSeriesNumberExtensions.cs @@ -21,6 +21,6 @@ public static class INumberSeriesNumberExtensions /// /// The converted object. /// - public static NumberSeriesNumber ToSimulatedDatabaseEntity(this INumberSeriesNumber target) => new NumberSeriesNumber(target); + public static NumberSeriesNumber ToSimulatedDatabaseEntity(this INumberSeriesNumber target) => new(target); } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedAutofacDependencyPackage.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedAutofacDependencyPackage.cs index 987e1337..32aa72a8 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedAutofacDependencyPackage.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedAutofacDependencyPackage.cs @@ -33,7 +33,7 @@ public SimulatedAutofacDependencyPackage() /// /// The package's dependency modules. /// - protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new IDependencyModule[] + protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new[] { new SimulatedAutofacDependencyModule(applicationConfiguration) }; diff --git a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedDatabaseModelDependencyModule.cs b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedDatabaseModelDependencyModule.cs index 080bb292..c3542ac8 100644 --- a/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedDatabaseModelDependencyModule.cs +++ b/test/RapidField.SolidInstruments.DataAccess.EntityFramework.UnitTests/SimulatedDatabaseModelDependencyModule.cs @@ -45,7 +45,7 @@ public SimulatedDatabaseModelDependencyModule(IConfiguration applicationConfigur protected override void Configure(ServiceCollection configurator, IConfiguration applicationConfiguration) { // Register unit-of-work types. - configurator.AddScoped(provider => new SimulatedInMemoryContext(provider.GetService(), "Simulated")); + configurator.AddScoped(provider => new(provider.GetService(), "Simulated")); configurator.AddScoped(); // Register data access command handlers. diff --git a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedBarDataStore.cs b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedBarDataStore.cs index 23d81d1d..db8f59a8 100644 --- a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedBarDataStore.cs +++ b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedBarDataStore.cs @@ -56,9 +56,6 @@ public SimulatedBarDataStore(IEnumerable entities) /// /// Represents the default values for a data store. /// - private static readonly Int32[] DefaultValues = new Int32[] - { - 0, 1, 2, 3, 4, 5, 6, 7 - }; + private static readonly Int32[] DefaultValues = { 0, 1, 2, 3, 4, 5, 6, 7 }; } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedFooDataStore.cs b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedFooDataStore.cs index 472479f2..dad1f979 100644 --- a/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedFooDataStore.cs +++ b/test/RapidField.SolidInstruments.DataAccess.UnitTests/SimulatedFooDataStore.cs @@ -56,7 +56,7 @@ public SimulatedFooDataStore(IEnumerable entities) /// /// Represents the default values for a data store. /// - private static readonly String[] DefaultValues = new String[] + private static readonly String[] DefaultValues = { String.Empty, "foo", "bar", "foobar", "foo", "bar", "foobar", "buzz" }; diff --git a/test/RapidField.SolidInstruments.InversionOfControl.Autofac.UnitTests/SimulatedAutofacDependencyPackage.cs b/test/RapidField.SolidInstruments.InversionOfControl.Autofac.UnitTests/SimulatedAutofacDependencyPackage.cs index 1a063a24..87b27f3a 100644 --- a/test/RapidField.SolidInstruments.InversionOfControl.Autofac.UnitTests/SimulatedAutofacDependencyPackage.cs +++ b/test/RapidField.SolidInstruments.InversionOfControl.Autofac.UnitTests/SimulatedAutofacDependencyPackage.cs @@ -31,7 +31,7 @@ public SimulatedAutofacDependencyPackage() /// /// The package's dependency modules. /// - protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new IDependencyModule[] + protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new[] { new SimulatedAutofacDependencyModule(applicationConfiguration) }; diff --git a/test/RapidField.SolidInstruments.InversionOfControl.DotNetNative.UnitTests/SimulatedDotNetNativeDependencyPackage.cs b/test/RapidField.SolidInstruments.InversionOfControl.DotNetNative.UnitTests/SimulatedDotNetNativeDependencyPackage.cs index a078e7f4..2c97c755 100644 --- a/test/RapidField.SolidInstruments.InversionOfControl.DotNetNative.UnitTests/SimulatedDotNetNativeDependencyPackage.cs +++ b/test/RapidField.SolidInstruments.InversionOfControl.DotNetNative.UnitTests/SimulatedDotNetNativeDependencyPackage.cs @@ -31,7 +31,7 @@ public SimulatedDotNetNativeDependencyPackage() /// /// The package's dependency modules. /// - protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new IDependencyModule[] + protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new[] { new SimulatedDotNetNativeDependencyModule(applicationConfiguration) }; diff --git a/test/RapidField.SolidInstruments.InversionOfControl.UnitTests/SimulatedSourceConfigurator.cs b/test/RapidField.SolidInstruments.InversionOfControl.UnitTests/SimulatedSourceConfigurator.cs index e1c34fc8..f1c86165 100644 --- a/test/RapidField.SolidInstruments.InversionOfControl.UnitTests/SimulatedSourceConfigurator.cs +++ b/test/RapidField.SolidInstruments.InversionOfControl.UnitTests/SimulatedSourceConfigurator.cs @@ -25,7 +25,7 @@ public SimulatedSourceConfigurator() /// /// A new . /// - public SimulatedSourceContainer Build() => new SimulatedSourceContainer(TestValue); + public SimulatedSourceContainer Build() => new(TestValue); /// /// Represents a test value that is injected into resolved objects. diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/MessageListeners/RequestResponse/Ping/RequestListener.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/MessageListeners/RequestResponse/Ping/RequestListener.cs index 83c4b7bc..d194e89e 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/MessageListeners/RequestResponse/Ping/RequestListener.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/MessageListeners/RequestResponse/Ping/RequestListener.cs @@ -54,6 +54,6 @@ public RequestListener(ICommandMediator mediator) /// /// The result that is emitted when processing the command. /// - protected override AssociatedResponseMessage Process(AssociatedRequestMessage command, ICommandMediator mediator, IConcurrencyControlToken controlToken) => new AssociatedResponseMessage(command.Identifier, command.CorrelationIdentifier); + protected override AssociatedResponseMessage Process(AssociatedRequestMessage command, ICommandMediator mediator, IConcurrencyControlToken controlToken) => new(command.Identifier, command.CorrelationIdentifier); } } \ No newline at end of file diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs index b4bec699..c93ca897 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Customer/DomainModel.cs @@ -82,7 +82,7 @@ internal static class Named /// A collection of all known instances. /// [DebuggerHidden] - internal static IEnumerable All() => new DomainModel[] + internal static IEnumerable All() => new[] { AcmeCo, SmithIndustries @@ -92,7 +92,7 @@ internal static class Named /// Gets the ACME Co. customer. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static DomainModel AcmeCo => new DomainModel(Guid.Parse("8e953a24-2d7f-4be1-96aa-c5288ad380ad")) + internal static DomainModel AcmeCo => new(Guid.Parse("8e953a24-2d7f-4be1-96aa-c5288ad380ad")) { Name = "ACME Co." }; @@ -101,7 +101,7 @@ internal static class Named /// Gets the Smith Industries customer. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static DomainModel SmithIndustries => new DomainModel(Guid.Parse("c2e497e2-ab27-457c-808d-8dfd74c9748d")) + internal static DomainModel SmithIndustries => new(Guid.Parse("c2e497e2-ab27-457c-808d-8dfd74c9748d")) { Name = "Smith Industries" }; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs index ebd95850..a5dab319 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/Models/Product/DomainModel.cs @@ -105,7 +105,7 @@ internal static class Named /// A collection of all known instances. /// [DebuggerHidden] - internal static IEnumerable All() => new DomainModel[] + internal static IEnumerable All() => new[] { Fidget, Widget @@ -115,7 +115,7 @@ internal static class Named /// Gets the Fidget product. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static DomainModel Fidget => new DomainModel(Guid.Parse("dc177df0-2b54-44e6-a166-55c3b4403d5f")) + internal static DomainModel Fidget => new(Guid.Parse("dc177df0-2b54-44e6-a166-55c3b4403d5f")) { Name = "Fidget", Price = 1.99m @@ -125,7 +125,7 @@ internal static class Named /// Gets the Widget product. /// [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal static DomainModel Widget => new DomainModel(Guid.Parse("acec6baf-66e2-49c1-92e5-37f1b9722e73")) + internal static DomainModel Widget => new(Guid.Parse("acec6baf-66e2-49c1-92e5-37f1b9722e73")) { Name = "Widget", Price = 13.69m diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedDependencyPackage.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedDependencyPackage.cs index fb9ea0b7..3c8f7aa4 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedDependencyPackage.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedDependencyPackage.cs @@ -33,7 +33,7 @@ public SimulatedDependencyPackage() /// /// The package's dependency modules. /// - protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new IDependencyModule[] + protected override IEnumerable> CreateModules(IConfiguration applicationConfiguration) => new[] { new SimulatedDependencyModule(applicationConfiguration) }; diff --git a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedServiceState.cs b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedServiceState.cs index d33dfb4e..b385463c 100644 --- a/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedServiceState.cs +++ b/test/RapidField.SolidInstruments.Messaging.InMemory.UnitTests/SimulatedServiceState.cs @@ -11,8 +11,8 @@ namespace RapidField.SolidInstruments.Messaging.InMemory.UnitTests /// internal static class SimulatedServiceState { - internal static readonly List CustomerOrders = new List(); - internal static readonly List Customers = new List(); - internal static readonly List Products = new List(); + internal static readonly List CustomerOrders = new(); + internal static readonly List Customers = new(); + internal static readonly List Products = new(); } } \ No newline at end of file