I'm getting data in to parse and I have a generic parser that I have given instructions on a per field basis about the data type and format (if applicable) of the data.
For example:
<Field Name="DateTime" Type="Pattern" Expression="\d{8} \d{2}\:\d{2}\:\d{2}" DataType="System.DateTime" Format="yyyyMMdd HH:mm:ss" />
Type could be date, integer, decimal, any value type. Format could any date or numeric format.
Convert.ChangeType does not have an overload that just takes a custom format string. I tried to implement IFormatProvider but I don't know how to make that work.
So I'm trying to figure out how to make this method work in the most generic way possible.
Public Function ConvertValue(Value As String, Type As System.Type, Format As String) As Object
End Function
An example of date data would be "20141215 10:07:25" {String}, so I would just call ConvertValue("20141215 10:07:25", GetType(DateTime), "yyyyMMdd HH:mm:ss")

ConvertValuemethod?ExpressionandTypehere?