Provides a collection of utility methods and properties for various helper functionalities. This static class includes methods for working with dynamic objects, arrays, types, and UI elements.
More...
|
static bool | EOHasProperty (this ExpandoObject obj, string propertyName) |
| Determines whether the specified ExpandoObject contains a property with the given name.
|
static ScrollViewer | FindScrollViewer (this FlowDocumentScrollViewer flowDocumentScrollViewer) |
| Retrieves the ScrollViewer contained within the specified FlowDocumentScrollViewer.
|
static string | DynamicString< T > (this T[] objT) |
| Converts an array of type T into a formatted string representation.
|
static string | DynamicString< T > (this T obj, params string[] propertiesToSkip) |
| Generates a string representation of the specified object, including its public properties and fields.
|
static object | GetDefaultValue (this Type type) |
| Retrieves the default value for a specified Type.
|
|
static string | AssemblyDirectory [get] |
| Gets the directory path of the currently executing assembly.
|
Provides a collection of utility methods and properties for various helper functionalities. This static class includes methods for working with dynamic objects, arrays, types, and UI elements.
◆ DynamicString< T >() [1/2]
string ff14bot.Helpers.Utils.DynamicString< T > |
( |
this T | obj, |
|
|
params string[] | propertiesToSkip ) |
|
static |
Generates a string representation of the specified object, including its public properties and fields.
- Template Parameters
-
T | The type of the object to generate the string representation for. |
- Parameters
-
obj | The object to generate the string representation for. |
propertiesToSkip | An array of property names to exclude from the string representation. |
- Returns
- A string representation of the object, including its public properties and fields, excluding those specified in propertiesToSkip . Default values and null values are also excluded.
This method is particularly useful for debugging or logging purposes, as it provides a detailed view of an object's state.
◆ DynamicString< T >() [2/2]
string ff14bot.Helpers.Utils.DynamicString< T > |
( |
this T[] | objT | ) |
|
|
static |
Converts an array of type T into a formatted string representation.
- Template Parameters
-
T | The type of elements in the array. |
- Parameters
-
objT | The array to convert to a string. |
- Returns
- A string representation of the array. If the array is
null
or empty, returns "[]". For arrays of IntPtr, elements are formatted as hexadecimal values. For other types, elements are converted using their object.ToString method.
This method provides a convenient way to visualize the contents of an array in a readable format.
◆ EOHasProperty()
bool ff14bot.Helpers.Utils.EOHasProperty |
( |
this ExpandoObject | obj, |
|
|
string | propertyName ) |
|
static |
Determines whether the specified ExpandoObject contains a property with the given name.
- Parameters
-
obj | The ExpandoObject to check for the property. |
propertyName | The name of the property to look for. |
- Returns
true
if the obj contains a property with the specified propertyName ; otherwise, false
.
- Exceptions
-
ArgumentNullException | Thrown if propertyName is null . |
This method is an extension method for ExpandoObject and provides a convenient way to check for the existence of a property in a dynamic object.
◆ FindScrollViewer()
ScrollViewer ff14bot.Helpers.Utils.FindScrollViewer |
( |
this FlowDocumentScrollViewer | flowDocumentScrollViewer | ) |
|
|
static |
Retrieves the ScrollViewer contained within the specified FlowDocumentScrollViewer.
- Parameters
-
flowDocumentScrollViewer | The FlowDocumentScrollViewer from which to retrieve the ScrollViewer. |
- Returns
- The ScrollViewer if found; otherwise,
null
.
◆ GetDefaultValue()
object ff14bot.Helpers.Utils.GetDefaultValue |
( |
this Type | type | ) |
|
|
static |
Retrieves the default value for a specified Type.
- Parameters
-
type | The Type for which to retrieve the default value. |
- Returns
- The default value of the specified type . Returns
null
if the type is null
, not a value type, represents void, or contains generic parameters.
- Exceptions
-
ArgumentException | Thrown when the default instance of the supplied value type cannot be created. |
◆ AssemblyDirectory
string ff14bot.Helpers.Utils.AssemblyDirectory |
|
staticget |
Gets the directory path of the currently executing assembly.
This property retrieves the directory path where the executing assembly is located. It is useful for resolving file paths relative to the assembly's location.
A string representing the directory path of the executing assembly.