M-Files / VAF.Extensions.Community

Community-built .NET extension methods for use with the M-Files Vault Application Framework.
MIT License
25 stars 20 forks source link

Added: IEnumerable<T>.EnsureNotNull() and EnvironmentBase.CurrentUserIsSystemProcess #95

Closed CraigHawker closed 1 year ago

CraigHawker commented 1 year ago

Added IEnumerableExtensionMethods.EnsureNotNull(). Returns the collection passed (if not null), or returns Enumerable.Empty if the collection is null.

Added EnvironmentBase.CurrentUserIsSystemProcess() Returns true if the user ID is equal to or less than zero, or false if the user ID is a valid user ID.

Added unit tests for above.

OskiKervinen-MF commented 1 year ago

"Ensure" sounds a bit imperative to me. What about AsNotNull or ToNotNull? NullToEmpty would be more explicit. Too much so?

I think I have often seen the "Is" put in front of the name in functions like this. How would IsCurrentUserSystemProcess sound to you?

CraigHawker commented 1 year ago

"Ensure" sounds a bit imperative to me. What about AsNotNull or ToNotNull? NullToEmpty would be more explicit. Too much so?

I think I have often seen the "Is" put in front of the name in functions like this. How would IsCurrentUserSystemProcess sound to you?

Good call on both. Changed in 2d55a0aa94007554cd83c1beb8dd25ce8fc37f5d.