The type or namespace name 'IConvertible' could not be found

1.5k views Asked by At

I am trying to implement IConvertible for custom transform. I am using .NET portable and it seems that it is not available there. But the MSDN documentation says:

Portable Class Library
Supported in: Portable Class Library

I am a bit worried by this which also appears :

This API is not CLS-compliant.

Is this the reason why it might not be getting resolved? As per the documentation, it should be a part of System namespace. I am trying to implement the interface in a structure.

Something on the lines of :

public struct ABC: Blah<Demo>, IConvertible 
{}

I have a feeling I am am missing out on something really small.
More information: I am targeting .NET Framework 4.5 and Windows 8.

1

There are 1 answers

3
Damien_The_Unbeliever On BEST ANSWER

"Supported in: Portable Class Library" is merely the start of working out whether it's supported in your scenario. You also have to look at the further information about support to see whether your PCL targets are supported. You've said you're targeting .NET Framework 4.5 and Windows 8. Let's compare the support information for IConvertible and, say IComparable:

IConvertible:

.NET Framework
Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
.NET Framework Client Profile
Supported in: 4, 3.5 SP1
Portable Class Library
Supported in: Portable Class Library
.NET for Windows Phone apps
Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

And IComparable:

.NET Framework
Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0
.NET Framework Client Profile
Supported in: 4, 3.5 SP1
Portable Class Library
Supported in: Portable Class Library
.NET for Windows Store apps
Supported in: Windows 8
.NET for Windows Phone apps
Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

So, after we've established "it's supported in a PCL", you then need to look at the other sections and compare that to your set of targets. If any of your targets isn't also listed as supported, then you'll not be able to use that type in your current PCL (without removing the targets that aren't supported)