public ResourceNode(ITypeMapper typeMapper, PathNode parent, string name, Func<object> valueFetcher, ResourceType expectedType) : base(typeMapper, parent, name) { this.value = new System.Lazy<object>(valueFetcher); this.expectedType = expectedType; this.type = new System.Lazy<ResourceType>(() => { var localValue = Value; if (Value == null) return expectedType; return (ResourceType)typeMapper.GetClassMapping(localValue.GetType()); }); }