-
-
Save anonymous/92c5336cc555ae83b4467e401413bb2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool IsItemsSourceEmpty() | |
{ | |
if (DataSource == null) | |
return true; | |
var collection = DataSource as ICollection; | |
if (collection != null) | |
return collection.Count > 0; | |
var enumerator = DataSource.GetEnumerator(); | |
var hasElement = enumerator.MoveNext(); | |
(enumerator as IDisposable)?.Dispose(); | |
return !hasElement; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment