private object RelaxedConvertLeafNode(Type desiredType, Node node, object defaultValue)
{
if (node == null)
{
return defaultValue;
}
if (node.NodeType != NodeType.Leaf)
{
throw new BindingException("Expected LeafNode, found {0} named {1}", node.NodeType, node.Name);
}
bool conversionSucceeded;
object result = ConvertLeafNode(desiredType, (LeafNode) node, out conversionSucceeded);
return conversionSucceeded ? result : defaultValue;
}