Implements Extensions that aim to fix api differences between .Net Standard and .Net/.Net Framework.
More...
|
static bool | IsCompletedSuccessfully (this Task task) |
| Returns true if the Task is completed successfully.
|
|
static bool | EndsWith (this string str, char c) |
| Returns true if the string ends with the given character.
|
|
static bool | StartsWith (this string str, char c) |
| Returns true if the string starts with the given character.
|
|
static IEnumerable< T > | SkipLast< T > (this IEnumerable< T > e, int count) |
| Skips the last n elements of an IEnumerable.
|
|
static T | GetProperty< T > (this BadObject obj, string propName) |
| Returns a Property, unwrapped to the specified type, from the given object.
|
|
Implements Extensions that aim to fix api differences between .Net Standard and .Net/.Net Framework.
Definition at line 9 of file BadExtensions.cs.
◆ EndsWith()
static bool BadScript2.Utility.BadExtensions.EndsWith |
( |
this string |
str, |
|
|
char |
c |
|
) |
| |
|
static |
Returns true if the string ends with the given character.
- Parameters
-
str | The String |
c | The Character |
- Returns
- True if string ends with character
Definition at line 27 of file BadExtensions.cs.
28 {
29 return str[str.Length - 1] == c;
30 }
◆ GetProperty< T >()
static T BadScript2.Utility.BadExtensions.GetProperty< T > |
( |
this BadObject |
obj, |
|
|
string |
propName |
|
) |
| |
|
static |
Returns a Property, unwrapped to the specified type, from the given object.
- Parameters
-
obj | The Object |
propName | The Property Name |
- Template Parameters
-
- Returns
- The Property Value
Definition at line 77 of file BadExtensions.cs.
78 {
80
81 return reference.Dereference().Unwrap<T>();
82 }
virtual BadObjectReference GetProperty(string propName, BadScope? caller=null)
Returns a Reference to the Property with the given Name.
Implements the base functionality for a BadScript Reference.
◆ IsCompletedSuccessfully()
static bool BadScript2.Utility.BadExtensions.IsCompletedSuccessfully |
( |
this Task |
task | ) |
|
|
static |
Returns true if the Task is completed successfully.
- Parameters
-
- Returns
- True if completed successfully
Definition at line 16 of file BadExtensions.cs.
17 {
18 return task.Status == TaskStatus.RanToCompletion;
19 }
◆ SkipLast< T >()
static IEnumerable< T > BadScript2.Utility.BadExtensions.SkipLast< T > |
( |
this IEnumerable< T > |
e, |
|
|
int |
count |
|
) |
| |
|
static |
Skips the last n elements of an IEnumerable.
- Parameters
-
e | The Enumerable |
count | The amount of elements to skip |
- Template Parameters
-
- Returns
- Enumerable with the last 'count' elements removed
Definition at line 50 of file BadExtensions.cs.
51 {
52 Queue<T> q = new Queue<T>(count + 1);
53
54 foreach (T item in e)
55 {
56 if (q.Count == count + 1)
57 {
58 yield return q.Dequeue();
59 }
60
61 q.Enqueue(item);
62 }
63
64 if (q.Count == count + 1)
65 {
66 yield return q.Dequeue();
67 }
68 }
◆ StartsWith()
static bool BadScript2.Utility.BadExtensions.StartsWith |
( |
this string |
str, |
|
|
char |
c |
|
) |
| |
|
static |
Returns true if the string starts with the given character.
- Parameters
-
str | The String |
c | The Character |
- Returns
- True if string starts with character
Definition at line 38 of file BadExtensions.cs.
39 {
40 return str[0] == c;
41 }
The documentation for this class was generated from the following file: