직렬화하면 오류 복사 및 붙여넣기에서 windows 양식을 통제하 WPF 컨트롤

0

질문

우리는 직렬화 등의 데이터를 보유하고 클립보드에서 패스에서 윈도우에서 제어하는 WPF 제어합니다. 이에서 일했 framework4.8 후 변환니다.Net5 우리는 이제 오류가 발생합니다. 형'시스템이다.RuntimeType'어셈블리에서'시스템이다.Private.CoreLib,Version=5.0.0.0,Culture=neutral,PublicKeyToken=7cec85d7bea7798e'으로 표시되지 않은 직렬화.

이 발생합에서 드롭다운 이벤트를 처리기 WPF 라인:

var tClip = e.Data.GetDataPresent(typeof(ClipboardDescriptor));

여기서'e'는 시스템입니다.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; }
        }
    }
}
.net-5 c# wpf
2021-11-22 21:52:28
1

최고의 응답

0

이는 해결책을 마련 중입니다. 이 경우에는 다행히 트성되었거 형태 속성을 추가할 수 있도록 유형은 검색할 수 없습니다.

using System;

namespace JMPT.Support.Classes
{
    /// <summary>
    /// Summary description for ClipboardDescriptor.
    /// </summary>
    [Serializable]
    public class ClipboardDescriptor
    {
        public Guid ParentDocumentID { get; set; }
        public Guid ID { get; set; }
        [field: NonSerialized]
        public Type ObjType { get; set; }
        public string ObjName { get; set; }
        public string ObjTypeName { get; set; }
    }
}
  
2021-11-23 16:59:35

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................