Apply R# clean-up for reliability (#877)

* Apply R# clean-up for reliability

- Migrate to NUnit4 Assert.That
- Update dependencise versions
- Fix LangVersion to 9.0 (until net core migration)
- Reformat code
- Apply 'var' style (easier for refactoring)
- Remove redundant parentheses
- Add braces on every condition blocks (1 line)
- Uses new null checking patterns
- Uses AutoProperties when possible
- Uses string scalar type instead of class
- Clean usings
- Add .orig files in git ignore
- Rename some properties to respect defined conventions and US format definition
	- ID -> Id
	- BPM -> Bpm
	- Finish -> End

* Update R# settings according to the clean-up made
This commit is contained in:
Quentin Bray authored and GitHub committed 2026-06-22 19:52:06 +02:00
1 parent b9b0f7c8df
commit 6ffa63b923
236 files changed
+14194 -7278

No files matched your search

+17 -7
View File
@@ -1,9 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VocaluxeLib.Utils
{
@@ -27,9 +23,15 @@ namespace VocaluxeLib.Utils
public CObjectPool(Func<T> objectGenerator, int poolSize)
{
if (objectGenerator == null)
{
throw new ArgumentNullException(nameof(objectGenerator));
}
if (poolSize <= 0)
{
throw new ArgumentNullException(nameof(poolSize));
}
_Objects = new ConcurrentBag<T>();
_ObjectGenerator = objectGenerator;
_Poolsize = poolSize;
@@ -42,7 +44,11 @@ namespace VocaluxeLib.Utils
public T GetObject()
{
T item;
if (_Objects.TryTake(out item)) return item;
if (_Objects.TryTake(out item))
{
return item;
}
return _ObjectGenerator();
}
@@ -52,10 +58,14 @@ namespace VocaluxeLib.Utils
/// <param name="item">The object instance that is given back to the pool.</param>
public void PutObject(T item)
{
if(_Objects.Count < _Poolsize)
if (_Objects.Count < _Poolsize)
{
_Objects.Add(item);
}
else
{
(item as IDisposable)?.Dispose();
}
}
}
}
}