/// <summary> Deserialization implementation for SecureString. </summary>
        /// <param name="node"></param>
        /// <param name="targetType"></param>
        /// <param name="setResult"></param>
        /// <returns></returns>
        public override bool Deserialize(XElement node, ITypeData targetType, Action <object> setResult)
        {
            if (targetType.IsA(typeof(System.Security.SecureString)) == false)
            {
                return(false);
            }
            string valueString = node.Value;
            var    result      = new System.Security.SecureString();

            setResult(result);
            try
            {
                string encryptedString = CryptographyHelper.Decrypt(valueString, password);
                foreach (var c in encryptedString)
                {
                    result.AppendChar(c);
                }

                return(true);
            }
            catch
            {
                return(true);
            }
        }
        /// <summary>
        /// Serialization implementation for SecureString.
        /// </summary>
        /// <param name="elem"></param>
        /// <param name="obj"></param>
        /// <param name="expectedType"></param>
        /// <returns></returns>
        public override bool Serialize(XElement elem, object obj, ITypeData expectedType)
        {
            if (obj is System.Security.SecureString == false)
            {
                return(false);
            }
            var sec = (System.Security.SecureString)obj;

            var unsec = sec.ConvertToUnsecureString();

            elem.Value = CryptographyHelper.Encrypt(unsec, password);

            return(true);
        }