public static void RemoveAttachment(this object parent, string name) { var attchments = WeakAttachmentsManager.GetAttachments(parent); if (attchments != null) { attchments.SetAttachment(name, null); } }
public static object GetAttachment(this object parent, string name) { var attchments = WeakAttachmentsManager.GetAttachments(parent); if (attchments != null) { return(attchments.GetAttachment(name)); } return(null); }
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); } }
public static void ClearAttachments(this object parent) { WeakAttachmentsManager.ClearAttachments(parent); }