コード例 #1
0
        public static void RemoveAttachment(this object parent, string name)
        {
            var attchments = WeakAttachmentsManager.GetAttachments(parent);

            if (attchments != null)
            {
                attchments.SetAttachment(name, null);
            }
        }
コード例 #2
0
        public static object GetAttachment(this object parent, string name)
        {
            var attchments = WeakAttachmentsManager.GetAttachments(parent);

            if (attchments != null)
            {
                return(attchments.GetAttachment(name));
            }
            return(null);
        }
コード例 #3
0
 public static void SetAttachment(this object parent, string name, object attach)
 {
     if (name == null)
     {
         ClearAttachments(parent);
     }
     else if (attach == null)
     {
         RemoveAttachment(parent, name);
     }
     else
     {
         WeakAttachmentsManager.GetOrCreateAttachments(parent).SetAttachment(name, attach);
     }
 }
コード例 #4
0
 public static void ClearAttachments(this object parent)
 {
     WeakAttachmentsManager.ClearAttachments(parent);
 }