Class AssemblyUtils
Contains Assembly, PropertyInfo and Type related static methods.
public static class AssemblyUtils
- Inheritance
-
AssemblyUtils
Fields
- Default
Gets initialized instance of the BaseObject for the different purposes.
- DefaultBindingFlags
Gets default binding flags.
- MaxValueByte
Gets maximal possible variable value for the byte type as object.
- MaxValueDateTime
Gets maximal possible variable value for the DateTime type as object.
- MaxValueDecimal
Gets maximal possible variable value for the decimal type as object.
- MaxValueDouble
Gets maximal possible variable value for the double type as object.
- MaxValueInt16
Gets maximal possible variable value for the short type as object.
- MaxValueInt32
Gets maximal possible variable value for the int type as object.
- MaxValueInt64
Gets maximal possible variable value for the long type as object.
- MaxValueSByte
Gets maximal possible variable value for the sbyte type as object.
- MaxValueSingle
Gets maximal possible variable value for the float type as object.
- MaxValueUInt16
Gets maximal possible variable value for the ushort type as object.
- MaxValueUInt32
Gets maximal possible variable value for the uint type as object.
- MaxValueUInt64
Gets maximal possible variable value for the ulong type as object.
- MinValueByte
Gets minimal possible variable value for the byte type as object.
- MinValueDateTime
Gets minimal possible variable value for the DateTime type as object.
- MinValueDecimal
Gets minimal possible variable value for the decimal type as object.
- MinValueDouble
Gets minimal possible variable value for the double type as object.
- MinValueInt16
Gets minimal possible variable value for the short type as object.
- MinValueInt32
Gets minimal possible variable value for the int type as object.
- MinValueInt64
Gets minimal possible variable value for the long type as object.
- MinValueSByte
Gets minimal possible variable value for the sbyte type as object.
- MinValueSingle
Gets minimal possible variable value for the float type as object.
- MinValueUInt16
Gets minimal possible variable value for the ushort type as object.
- MinValueUInt32
Gets minimal possible variable value for the uint type as object.
- MinValueUInt64
Gets minimal possible variable value for the ulong type as object.
Properties
- AllControlDescendants
Gets or sets list of all AbstractControl descendants.
- AllControlEvents
Gets or sets list of events for all AbstractControl descendants.
- SpecialDummyProperty
Special dummy property for the internal purposes.
- SpecialDummyPropertyInfo
Property info for the SpecialDummyProperty.
Methods
- CanResetProp(object?, PropertyInfo?)
Gets whether property item can be reset.
- CompareByName(EventInfo, EventInfo)
Compares two specified EventInfo objects by their names and returns an integer that indicates their relative position in the sort order.
- CompareByName(PropertyInfo, PropertyInfo)
Compares two specified PropertyInfo objects by their names and returns an integer that indicates their relative position in the sort order.
- CreateAction(object, MethodInfo)
Creates Action for the specified MethodInfo.
- CreateViaDefaultConstructor<T>()
Creates the specified type via default parameterless constructor.
- EnumEvents(Type, bool, BindingFlags)
Enumerates event information for the specified Type.
- EnumFields(Type, bool, BindingFlags)
Enumerates field information for the specified Type.
- EnumIsFlags(Type)
Returns whether enumeration has FlagsAttribute.
- EnumMethods(Type, BindingFlags)
Enumerates method information for the specified Type.
- EnumProps(Type, bool, BindingFlags)
Enumerates property information for the specified Type.
- EnumPublicObjectsForNamespace(Assembly, string)
Enumerates public objects declared in the specified namespace.
- FindAssemblyForResource(string)
Finds assembly for the specified resource name.
- GetAllDescendantsEvents(Type, BindingFlags)
Enumerates events in all descendants of the specified type.
- GetAllPublicMembers(IEnumerable<Assembly>?, BindingFlags?)
Enumerates members of all types in the loaded assemblies.
- GetAllPublicMembers(string, IEnumerable<Assembly>?, BindingFlags?)
Enumerates members of all types in the loaded assemblies filtered by name and binding constraint.
- GetAssemblyByName(string)
Gets Assembly with the specified name searching it through all assemblies of the current domain.
- GetAssemblyResPrefix(Assembly)
Gets prefix string for the embedded resource.
- GetAutoResetMembers(Type, bool, bool, BindingFlags)
Gets collection of the fields and properties marked with AutoResetAttribute attribute.
- GetBrowsable(MemberInfo)
Returns whether property, method or other member is browsable.
- GetControlCategory(Type)
Returns toolbox category of the control.
- GetDefaultNumberStyles(TypeCode)
Gets default NumberStyles for the specified
typeCode
.
- GetDefaultValue(PropertyInfo, out object?)
Gets default value of the property using DefaultValueAttribute.
- GetDefaultValue(TypeCode)
Gets default value for the given TypeCode.
- GetDescription(MemberInfo)
Gets value of thr Description for the specified member.
- GetEventArgsType(EventInfo?)
Gets type of the second parameter for the event. This is usually an EventArgs descendant.
- GetFieldValue<T>(object?, FieldInfo, T)
Gets field value using the specified object instance and field info.
- GetFirstMember(Type?, string, MemberTypes, BindingFlags)
Gets field or property information using the specified object type (or instance) and property name. Type of the object or the object itself must be specified.
- GetImageUrlInAssembly(Assembly, string?)
Gets image url for loading image resource from the specified assembly using "embres" protocol.
- GetMaxValue(TypeCode)
Gets maximal possible variable value for the given TypeCode.
- GetMinMaxRangeStr(TypeCode, string?, object?, object?)
Returns minimal and maximal possible values for the given TypeCode as a range string using specified
format
.
- GetMinValue(TypeCode)
Gets minimal possible variable value for the given TypeCode.
- GetNullable(PropertyInfo)
Returns whether property is nullable (for example byte?).
- GetPropInfo(object?, string?)
Gets property info.
- GetPropValue<T>(object?, PropertyInfo, T)
Gets property value using the specified object instance and property info.
- GetPropertySafe(Type?, string, BindingFlags)
Same as GetProperty(string) but doesn't raise exceptions.
- GetRealType(Type)
Gets real type, using GetUnderlyingType(Type).
- GetRealTypeCode(Type)
Gets TypeCode of the real type using GetRealType(Type) and GetTypeCode(Type).
- GetResetPropMethod(object, string)
Gets reset method for the specified property.
- GetSortedTypeDescendantsWithFullNames(Type)
Returns list of types which descend from specified type. Result is sorted by FullName and uses it as keys.
- GetStaticProperties<TProperty>(Type)
Gets all static properties of the specified type in the specifed container type. Returned only not null properties of the exact type
TProperty
.
- GetTypeByName(string, bool)
Gets the Type object with the specified name searching it through all assemblies of the current domain.
- GetTypeDescendants(Type)
Returns list of types which descend from specified type.
- GetTypeDisplayName(Type)
Gets user friendly type name.
- GetTypeNameUsingCodeDom(Type, string?)
Gets type name using CodeDomProvider.
- HasConstructorNoParams(Type)
Gets whether Type has constructor without parameters.
- HasConstructorWithParam(Type, Type)
Gets whether Type has a public instance constructor with single parameter which has the specified type.
- HasConstructorWithParams(Type, Type[])
Gets whether Type has a public instance constructor whose parameters match the types in the specified array.
- HasOwnEvents(Type?)
Gets whether specified type has declared events (events declared in the parent types are not counted).
- InvokeBoolMethod(Type?, string, object?, object[]?)
Invokes method with boolean result through the reflection.
- InvokeBoolMethod<T>(string, object?, object[]?)
Invokes method with boolean result through the reflection.
- InvokeIsAndroid()
Invokes 'OperatingSystem.IsAndroid' through the reflection.
- InvokeIsIOS()
Invokes 'OperatingSystem.IsAndroid' through the reflection.
- InvokeMauiUtilsGetDevicePlatform()
Gets device platform using invoke of 'MauiUtils.GetDevicePlatform'.
- InvokeMauiUtilsGetDeviceType()
Gets device the app is running on, such as a desktop computer or a tablet. Uses invoke of 'MauiUtils.GetDeviceType'.
- InvokeMauiUtilsIsMacCatalyst()
Gets whether device platform is MacCatalyst using invoke of 'MauiUtils.IsMacCatalyst'.
- InvokeMethodWithResult(Type?, string, object?, object[]?)
Invokes method with object result through the reflection.
- IsAssemblyReferencedFrom(Assembly, IEnumerable<Assembly>)
Gets whether
referenceContainer
assembly references any assembly fromn thepossibleReference
collection.
- IsAssemblyReferencedFrom(Assembly, Assembly)
Gets whether
referenceContainer
assembly referencespossibleReference
assembly.
- IsAutoReset(MemberInfo)
Returns whether property or field has AutoResetAttribute attribute and it's value property is True.
- IsControlDescendantEventName(string)
Gets whether specified string is name of the event declared in any descendant of the AbstractControl.
- IsEnumType(Type)
Gets whether the specified type is enumeration.
- IsInternalType(Type)
Gets whether the speciffied type is internal.
- IsNullableType(Type)
Gets whether the specified type is nullable.
- IsPublicType(Type?)
Helper for determine if the type is a public.
- IsReadOnly(PropertyInfo)
Gets whether property is readonly.
- IsStruct(Type?)
Gets whether Type is struct.
- IsTypeCodeFloat(TypeCode)
Returns
true
iftypeCode
is a floating point number type (float, double or decimal).
- IsTypeCodeNumber(TypeCode)
Returns
true
iftypeCode
is number type.
- IsTypeCodeSignedInt(TypeCode)
Returns
true
iftypeCode
is a signed integer number type (sbyte, short, int, long).
- IsTypeCodeUnsignedInt(TypeCode)
Returns
true
iftypeCode
is an unsigned integer number type (byte, ushort, uint, ulong).
- ResetProperty(object?, PropertyInfo?)
Resets property value using the specified instance and property info. Uses different methods to reset the property including: calling reset method, assigning default value from the attribute, assigning null value if property is nullable.
- ToggleBoolMember(Type?, object?, string)
Toggles boolean field or property specified by the type (or instance) and name.
- TryGetMemberValue<T>(Type?, object?, string, out T, T)
Gets property or field value using the specified object type (or instance) and property name. Type of the object or the object itself must be specified.
- TrySetMemberValue(object?, string, object?)
Sets property or field value using the specified object type (or instance) and property name. Type of the object or the object itself must be specified.
- TrySetMemberValue(Type?, object?, string, object?)
Sets property or field value using the specified object type (or instance) and property name. Type of the object or the object itself must be specified.
- TypeEqualsOrDescendant(Type, Type)
Returns
true
if specified type equalsbaseType
or is a descendant of that type.
- TypeEqualsOrDescendant(Type, Type[])
Returns
true
if specified type equals any type frombaseTypes
or is a descendant of that type.
- TypeIsDescendant(Type, Type)
Returns
true
if specified type is a descendant of another type.
- TypeIsDescendant(Type, Type[])
Returns
true
iftype
is a descendant of any type in the array of types.
- UpgradeNumberType(object)
Upgrades signed inegers to long, unsigned integers to ulong and returns all other types as is.