mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-16 11:42:52 +00:00
Add non-generic GetValue and improve documentation
This commit is contained in:
@@ -22,4 +22,23 @@ internal static class VariableAddressExtensions
|
||||
|
||||
public static bool MatchesType(this VariableAddress address, Type type) =>
|
||||
supportedTypeMap.TryGetValue(type, out var map) && map(address);
|
||||
|
||||
public static Type GetClrType(this VariableAddress address) =>
|
||||
address.Type switch
|
||||
{
|
||||
DbType.Bit => typeof(bool),
|
||||
DbType.String => typeof(string),
|
||||
DbType.WString => typeof(string),
|
||||
DbType.Byte => address.Length == 1 ? typeof(byte) : typeof(byte[]),
|
||||
DbType.Int => typeof(short),
|
||||
DbType.UInt => typeof(ushort),
|
||||
DbType.DInt => typeof(int),
|
||||
DbType.UDInt => typeof(uint),
|
||||
DbType.LInt => typeof(long),
|
||||
DbType.ULInt => typeof(ulong),
|
||||
DbType.Single => typeof(float),
|
||||
DbType.Double => typeof(double),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(address))
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user