Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Path for for handling empty (not provided) Guid values
// Replace constructor in line 53 with this one
public FieldNullValueAttribute(Type type, string nullValue)
: this(TypeDescriptor.GetConverter(type).ConvertFromString(nullValue))
{ }
// Unit test to be placed where it's more appropriate
public void RunTimeEmptyGuidProperties()
var builder = new DelimitedClassBuilder(typeof (EntityWithGuid).Name, "\t");
builder.AddField("Name", typeof (string));
builder.AddField("Id", typeof (Guid));
builder.LastField.FieldNullValue = Guid.Empty;
var engine = new FileHelperEngine(builder.CreateRecordClass())
Options = {IgnoreFirstLines = 1}
const string inputValue = @"Name Id
second ";
Assert.That(engine.ReadString(inputValue).Length, Is.EqualTo(2));
public class EntityWithGuid
public string Name { get; set; }
public Guid Id { get; set; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.