Exemple #1
0
 public TypeReader <Guid> GetReader()
 {
     return(value =>
     {
         try
         {
             return new Guid(value);
         }
         catch (Exception ex)
         {
             throw TypeSerializerException.New(this, value, ex);
         }
     });
 }
Exemple #2
0
 public TypeReader <T> GetReader()
 {
     return(value =>
     {
         try
         {
             var result = (T)Enum.Parse(typeof(T), value);
             return result;
         }
         catch (Exception ex)
         {
             throw TypeSerializerException.New(this, value, ex);
         }
     });
 }
Exemple #3
0
        public TypeReader <Uri> GetReader()
        {
            return(value =>
            {
                if (value == null || value.Length == 0)
                {
                    return null;
                }

                try
                {
                    return new Uri(value);
                }
                catch (UriFormatException ex)
                {
                    throw TypeSerializerException.New(this, value, ex);
                }
            });
        }