AutoMapper.Mappers.NameValueCollectionMapper.Map C# (CSharp) Method

Map() public static method

public static Map ( NameValueCollection source ) : NameValueCollection
source System.Collections.Specialized.NameValueCollection
return System.Collections.Specialized.NameValueCollection
        public static NameValueCollection Map(NameValueCollection source)
        {
            if (source == null)
                return null;

            var nvc = new NameValueCollection();
            foreach (var s in source.AllKeys)
                nvc.Add(s, source[s]);

            return nvc;
        }

Same methods

NameValueCollectionMapper::Map ( ResolutionContext context ) : object

Usage Example

            public void ReturnsNullIfSourceValueIsNull()
            {
                var rc = new ResolutionContext(null, null, new NameValueCollection(), typeof(NameValueCollection), typeof(NameValueCollection), null, Mapper.Engine);
                var nvcm = new NameValueCollectionMapper();

                var result = nvcm.Map(rc, null);

                result.ShouldBeNull();
            }
All Usage Examples Of AutoMapper.Mappers.NameValueCollectionMapper::Map
NameValueCollectionMapper