In ISerialized, Resharper is complaining that "Only implementations of 'SerializeShape" are used. Is there something more I should be doing, or is my use of an interface simply over-kill in this instance? My 'requirements' are that any use of class Shape implement SerializeShape. I am attempting to use Interface in a plausible, conventional way, but maybe I am not?
I have an interface of such:
namespace Shapes
{
internal interface ISerialized<in T>
{
string SerializeShape();
}
}
I have a class of such:
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace Shapes
{
[DataContract]
public class Shape : ISerialized<Shape>
{
[DataMember] public double Perimeter { get; set; }
[DataMember] public double Area { get; set; }
[DataMember] public string ShapeName { get; set; }
[DataMember] public string ShapeException { get; set; }
public string SerializeShape(Shape shape)
{
return JsonConvert.SerializeObject(shape, Formatting.Indented);
}
}
}