If you have this:
using System;
namespace YourNameSpace
{
public abstract class PersonBase
{
public PersonBase(Guid id)
{
Id = id;
}
internal Guid Id { private set; get; }
internal void ResetID(Guid id)
{
Id = id;
}
}
public class Person : PersonBase
{
public Person(Guid id) : base(id)
{
}
public Person() : base(Guid.Empty)
{
}
}
}
You can do this to use 'Activator.CreateInstance, and pass a value for the 'Guid parameter:
Person somePerson = Activator.CreateInstance(typeof (Person), new Object[]{Guid.NewGuid()}) as Person;
Hope that's helpful. If you are doing a lot fancy composition of .NET objects at run-time, I suggest you research the use of T4: [
^]