BarbezDotEu.Generic
Generic helper extension method adapted for Linq from https://stackoverflow.com/questions/2019417/how-to-access-random-item-in-list, http://www.albahari.com/nutshell/predicatebuilder.aspxamongst, and others.
Generates n number of items randomly from a given IEnumerable`1 source, even if the source list has less items than the number of items to return (as provided by the numberOfThings).
The random list.
Name | Type | Description |
---|---|---|
source | System.Collections.Generic.IEnumerable{``0} | The source. |
numberOfItems | System.Int32 | The number of items to take. |
Name | Description |
---|---|
T | The type. |
From a given IEnumerable`1, selects a random single item.
One item, randomly chosen from the given collection.
Name | Type | Description |
---|---|---|
source | System.Collections.Generic.IEnumerable{``0} | The source collection to pick one item out of. |
Name | Description |
---|---|
T | The type to pick one of. |
Picks an n number of items randomly from the IEnumerable`1. If n is larger than the number of items in the list, returns all items in the list only (which in this case is less than the number of items given to return).
The random list.
Name | Type | Description |
---|---|---|
source | System.Collections.Generic.IEnumerable{``0} | The source. |
count | System.Int32 | The number of items to take. |
Name | Description |
---|---|
T | The type. |
Randomly shuffles the given source collection.
A shuffled version of the given collection.
Name | Type | Description |
---|---|---|
source | System.Collections.Generic.IEnumerable{``0} | The collection to shuffle. |
Name | Description |
---|---|
T | The types to be found in the collection to shuffle. |
BarbezDotEu.Generic
Generic helper extension method adapted for Reflection from https://stackoverflow.com/a/1954663, amongst others.
Example use: DateTime now = DateTime.Now; int min = GetPropertyValue(now, "TimeOfDay.Minutes"); int hrs = now.GetPropertyValue("TimeOfDay.Hours");
This method has no parameters.