Home > database >  The type 'ImageConverter' exists in both
The type 'ImageConverter' exists in both

Time:10-01

In a Visual Studio Project this worked for a while

byte[] bytes = (byte[])new ImageConverter().ConvertTo(bitmap, typeof(byte[]));

Even for that

System.Drawing.ImageConverter imgConverter = new System.Drawing.ImageConverter();

Now Visual Studio Complains

CS0433  The type 'ImageConverter' exists in both 'System.Drawing.Common, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' and 'System.Windows.Extensions, Version=4.0.1.0,

What is odd here is that there is no System.Drawing.Common.ImageConverter !

There is just a System.Drawing.ImageConverter and I have already added using System.Drawing at the using section

After adding

System.ServiceModel.Duplex
System.ServiceModel.Http
System.ServiceModel.NetTcp
System.ServiceModel.Security

it seems to be not related and I have tried everything which I found about CS0433 with no solution so far. Any idea what have changed ? or what else could be tweaked to make clear I want to use explicitly System.Drawing.ImageConverter in a csharp project ?

CodePudding user response:

If I understand your question correctly you just need a full qualified name like:

> byte[] bytes = (byte[])new
> System.Drawing.Common.ImageConverter().ConvertTo(bitmap,
> typeof(byte[]));

This will remove the ambiguity about which library you want to draw it from.

CodePudding user response:

The issue has been solved by installing the latest Version of System.Windows.Extensions (5.0.0)

The issue has been raised and discussed with the core developers here

  • Related