Answer the question
In order to leave comments, you need to log in
How to serialize a class field that is an object described in another assembly (dll)?
I am using Microsoft.CodeAnalysis.CSharp.dll in my project. I have a class, the property of this class is an object that was described in Microsoft.CodeAnalysis.CSharp.dll and connected to my project.
[ProtoContract]
public class FunctionAnnotation :
{
[ProtoMember(1)] public IMethodSymbol Symbol { get; set; }
}
No serializer defined for type: Microsoft.CodeAnalysis.IMetnodSymbol.
private void Serialization()
{
string folderName = @"f:/serialization/";
Directory.CreateDirectory(folderName);
int name = this.Symbol.ToString().GetHashCode();
using (FileStream fs = new FileStream("f:/serialization/" + name + ".dat", FileMode.OpenOrCreate))
{
Serializer.Serialize(fs, this);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question