I am implementing ISerializer Interface,
in Deserialize method it access generic type
which is ProtocolBuffer Class in my case and here i have to Deserialize input string to protocolBuffer Class (Content)
but when i call Content.Parser.ParseFrom i get error saying
'Content' is type parameter which is not valid in given context;
i cant change Content class to fit my problem since it is generated using ProtoclBuffer Compiler for c# , also i cant change ISerializer since it is vendor library.
so what might be solution here ? how can i call Content.Parser.ParseFrom method
class PBFSerializer : ISerializer
{
public Content Deserialize<Content>(string json)
{
byte[] byteArray = Encoding.UTF8.GetBytes(json);
return Content.Parser.ParseFrom(byteArray);
//'Content' is type parameter which is not valid in given context;
}
public byte[] Serialize(object obj)
{
var content = (Content)obj;
return content.ToByteArray();
}
}