Skip to content

Commit 573d80b

Browse files
committed
Add implementation for IConvertible interface method ToType
1 parent ef20de8 commit 573d80b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/FirebirdSql.Data.FirebirdClient/Types/FbZonedDateTime.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,15 @@ public override int GetHashCode()
100100

101101
public string ToString(IFormatProvider provider) => throw new InvalidCastException(nameof(String));
102102

103-
public object ToType(Type conversionType, IFormatProvider provider) => throw new InvalidCastException(nameof(conversionType));
103+
public object ToType(Type conversionType, IFormatProvider provider)
104+
{
105+
if (ReferenceEquals(conversionType, typeof(FbZonedDateTime)))
106+
{
107+
return this;
108+
}
109+
110+
throw new InvalidCastException(conversionType?.FullName);
111+
}
104112

105113
public ushort ToUInt16(IFormatProvider provider) => throw new InvalidCastException(nameof(UInt16));
106114

0 commit comments

Comments
 (0)