Menu

#1 ObjectCreateRule.OnBegin()

open
nobody
None
5
2005-12-13
2005-12-13
No

I've pasted some code below from the current release.
You'll notice 'realType' is not called in the
CreateInstance, instead it's 'type'. However this code
will fail if no Type is defined but the type is pulled
from the Digester's attributes collection. My project
is currently using NDigester and will not run until
this is fixed.

public override void OnBegin()
{
// define a type of the object to create
Type realType = type;
if(attribute != null)
{
string val = digester.Attributes[attribute];
if(val != null)
{
realType = Type.GetType(val, true, true);
}
}

// create object instance
object obj = Activator.CreateInstance(type);
digester.Push(obj);
}

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.