/// <summary> /// This is used to instantiate the converter based on the type /// provided. If the type provided can not be instantiated for /// some reason then an exception is thrown from this method. /// </summary> /// <param name="type"> /// this is the converter type to be instantiated /// </param> /// <returns> /// this returns an instance of the provided type /// </returns> public Converter GetInstance(Class type) { Converter converter = cache.fetch(type); if (converter == null) { return(GetConverter(type)); } return(converter); }
/// <summary> /// This is used to acquire a <c>Converter</c> instance from /// the registry. All instances are cache to reduce the overhead /// of lookups during the serialization process. Converters are /// lazily instantiated and so are only created if demanded. /// </summary> /// <param name="type"> /// this is the type to find the converter for /// </param> /// <returns> /// this returns the converter instance for the type /// </returns> public Converter Lookup(Class type) { Converter converter = cache.fetch(type); if (converter == null) { return(Create(type)); } return(converter); }