public object Read(byte[] buffer, int index) { var start = index; var count = length; if (trim) { BytesHelper.TrimRange(buffer, ref start, ref count, padding, filler); } return(encoding.GetString(buffer, start, count)); }
public object Read(byte[] buffer, int index) { var start = index; var count = length; if (trim) { BytesHelper.TrimRange(buffer, ref start, ref count, padding, filler); } var value = encoding.GetString(buffer, start, count); if ((value.Length > 0) && Int32.TryParse(value, style, provider, out var result)) { return(convertEnumType is null ? result : Enum.ToObject(convertEnumType, result)); } return(defaultValue); }
public object Read(byte[] buffer, int index) { var start = index; var count = length; if (trim) { BytesHelper.TrimRange(buffer, ref start, ref count, padding, filler); } var value = encoding.GetString(buffer, start, count); if ((value.Length > 0) && Decimal.TryParse(value, style, provider, out var result)) { return(result); } return(defaultValue); }