Exemple #1
0
        /// <summary>
        /// Tries to read the typed value of the specified key.
        /// </summary>
        /// <typeparam name="T">The type</typeparam>
        /// <param name="key">Key name</param>
        /// <param name="value">If the key within the csv dictionary was found, contains the value. If not contains null</param>
        /// <returns>true if the key within the cuurent the csv dictionary was found; otherwise, false.</returns>
        public bool TryGetValue <T>(string key, out T value)
        {
            var keyValuePair = _keyValuePairs.Find(x => x.Key == key);

            if (keyValuePair.Key != null)
            {
                value = GetValue <T>(key, ConverterResolver.GetConverter <T>());
                return(true);
            }
            value = default;
            return(false);
        }
 /// <summary>
 /// Reads the typed value of the current csv record at the posiiton of the specified header name.
 /// </summary>
 /// <param name="type">Type of value</param>
 /// <param name="name">Name of a header</param>
 /// <returns>A typed value</returns>
 public object GetValue(Type type, string name)
 {
     return(GetValue(name, ConverterResolver.GetConverter(type)));
 }
 /// <summary>
 /// Read the value of the current csv record at the specified index.
 /// </summary>
 /// <param name="type">Type of value</param>
 /// <param name="index">Index within the current csv record</param>
 /// <returns>A string value</returns>
 public object GetValue(Type type, int index)
 {
     return(GetValue(index, ConverterResolver.GetConverter(type)));
 }
 /// <summary>
 /// Reads the typed value of the current csv record at the posiiton of the specified header name.
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="name">Name of a header</param>
 /// <returns>A typed value</returns>
 public T GetValue <T>(string name)
 {
     return(GetValue <T>(name, ConverterResolver.GetConverter <T>()));
 }
 /// <summary>
 /// Read the typed value of the current csv record at the specified index.
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="index">Index within the current csv record</param>
 /// <returns>A typed value</returns>
 public T GetValue <T>(int index)
 {
     return(GetValue <T>(index, ConverterResolver.GetConverter <T>()));
 }
Exemple #6
0
 /// <summary>
 /// Sets the value of the current csv record at the specified index.
 /// </summary>
 /// <param name="type">The type</param>
 /// <param name="index">Index within the current csv record</param>
 /// <param name="value">A value</param>
 public void SetValue(Type type, int index, object value)
 {
     SetValue(index, value, ConverterResolver.GetConverter(type));
 }
Exemple #7
0
 /// <summary>
 /// Sets the value of the current csv record at the position of the specified header name.
 /// </summary>
 /// <param name="type">The type</param>
 /// <param name="name">Name of a header</param>
 /// <param name="value">A value</param>
 public void SetValue(Type type, string name, object value)
 {
     SetValue(name, value, ConverterResolver.GetConverter(type));
 }
Exemple #8
0
 /// <summary>
 /// Sets the value of the current csv record at the specified index.
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="index">Index within the current csv record</param>
 /// <param name="value">A value</param>
 public void SetValue <T>(int index, T value)
 {
     SetValue(index, value, ConverterResolver.GetConverter <T>());
 }
Exemple #9
0
 /// <summary>
 /// Sets the value of the current csv record at the position of the specified header name.
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="name">Name of a header</param>
 /// <param name="value">A value</param>
 public void SetValue <T>(string name, T value)
 {
     SetValue(name, value, ConverterResolver.GetConverter <T>());
 }
 static ObjectMapperConfiguration()
 {
     ConverterResolver = new ConverterResolver();
     ConverterFactory  = new ConverterFactory();
 }
Exemple #11
0
 /// <summary>
 /// Sets the value of the specified key.
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="key">Key name</param>
 /// <param name="value">The value</param>
 public void SetValue <T>(string key, T value)
 {
     SetValue(key, value, ConverterResolver.GetConverter <T>());
 }
Exemple #12
0
 /// <summary>
 /// Gets the typed value of the specified key
 /// </summary>
 /// <param name="type">Type of value</param>
 /// <param name="name">Key name</param>
 /// <returns>A typed value</returns>
 public object GetValue(Type type, string key)
 {
     return(GetValue(key, ConverterResolver.GetConverter(type)));
 }
Exemple #13
0
 /// <summary>
 /// Gets the typed value of the specified key
 /// </summary>
 /// <typeparam name="T">The type</typeparam>
 /// <param name="name">Key name</param>
 /// <returns>A typed value</returns>
 public T GetValue <T>(string key)
 {
     return(GetValue <T>(key, ConverterResolver.GetConverter <T>()));
 }