private GetConverter ( |
||
type | ||
Résultat | Converter |
public void UserDefinedConvertersHavePriority() { var lookup = new ConverterLookup(); var alternateConverter = new AlternateStringConverter(); lookup.AddConverter(alternateConverter); Assert.That(lookup.GetConverter(typeof(string)), Is.EqualTo(alternateConverter)); }
public object ConvertAnother() { string nullAttribute = reader.GetAttribute(Attributes.Null); if (nullAttribute != null && nullAttribute == "true") { return(null); } object result = Find(); if (result != null) { return(result); } Converter converter = converterLookup.GetConverter(reader.GetNodeName()); if (converter == null) { return(ConvertOriginal()); } return(converter.FromXml(reader, this)); }
internal void ConvertAnother(object value) { Converter converter = converterLookup.GetConverter(value); if (converter != null) { converter.ToXml(value, writer, this); } else { ConvertObject(value); } }
private object ConvertField(Type fieldType) { string classAttribute = reader.GetAttribute(Attributes.classType); if (!string.IsNullOrEmpty(classAttribute)) { fieldType = Type.GetType(Xmlifier.UnXmlify(classAttribute)); } Converter converter = converterLookup.GetConverter(fieldType); if (converter != null) { return(converter.FromXml(reader, context)); } else { return(Unmarshal(fieldType)); } }
internal void ConvertAnother(object value) { if (value == null) { // TODO: Make this a configuration option // Don't export null values. return; } Converter converter = converterLookup.GetConverter(value); if (converter != null) { converter.ToXml(value, writer, this); } else { ConvertObject(value); } }
public void UserDefinedConvertersHavePriority () { var lookup = new ConverterLookup (); var alternateConverter = new AlternateStringConverter (); lookup.AddConverter (alternateConverter); Assert.That (lookup.GetConverter (typeof(string)), Is.EqualTo (alternateConverter)); }