I have a dotnet standard 2.0 project that implements an interface. I want to include a System.Windows.Point point in the interface, but I don't have access to System.Windows.Point in dotnet standard 2.0.
I have three projects:
- a dotnet 6.0 project
- a dotnet framework 4.7 project
- a project they both need to target (so .net standard 2.0 because that is compatible with both)
- I DON'T have access to System.Windows.Point
- I hold the interface that the other two projects use (the one that needs System.Windows.Point)
Is there a way to stub the Point class? so I would write a file that looks something like:
public interface MyInterface
{
System.Windows.Point myPoint {get;}
}
namespace System.Windows
{
#if NETSTANDARD2_0
[Obsolete("Warning: You aren't really using System.Windows.Point. This is a stub for .Net Standard 2.0")]
public class Point
{
public double X { get; }
public double Y { get; }
public Point(double x, double y)
{
X = x;
Y = y;
}
}
#endif
}
My example doesn't quite work - it creates a new, confusing System.Windows.Point class, so when I use the interface, it can't take regular System.Windows.Points, because it's not the real System.Windows.Point class. Not surprising, but....