हम एक serializable वर्ग में रखती है, डेटा क्लिपबोर्ड से पारित करने के लिए windows से नियंत्रण करने के लिए WPF नियंत्रण. इस काम में रूपरेखा 4.8 के बाद परिवर्तित करने के लिए .नेट 5 अब हम त्रुटि मिलती है: प्रकार 'System.RuntimeType' विधानसभा में 'प्रणाली.निजी.CoreLib, संस्करण 5.0.0.0, संस्कृति=तटस्थ, PublicKeyToken= = 7cec85d7bea7798e' नहीं है के रूप में चिह्नित serializable.
यह तब होता है में छोड़ ईवेंट हैंडलर WPF में लाइन पर:
var tClip = e.Data.GetDataPresent(typeof(ClipboardDescriptor));
जहां 'ई' प्रणाली है.Windows.DragEventArgs.
using System;
using System.Windows.Forms;
namespace Support.Classes
{
/// <summary>
/// Summary description for ClipboardDescriptor.
/// </summary>
[Serializable]
public class ClipboardDescriptor
{
private Guid id;
private Guid parentDocumentID;
private System.Type objtype;
private TreeNode baseTreeNode;
private string objname;
public ClipboardDescriptor()
{
baseTreeNode = null;
}
public Guid ParentDocumentID
{
get { return(parentDocumentID); }
set { parentDocumentID = value; }
}
public Guid ID
{
get { return(id); }
set { id = value; }
}
public System.Type ObjType
{
get { return(objtype); }
set { objtype = value; }
}
public string ObjName
{
get { return(objname); }
set { objname = value; }
}
/// <summary>
/// Get the treenode that this object is associated with
/// </summary>
public TreeNode BaseTreeNode
{
get { return(baseTreeNode); }
set { baseTreeNode = value; }
}
}
}