Menu

#227 Hack for NDoc compatability issue with C# 2.0

open
nobody
None
5
2005-01-29
2005-01-29
No

I have been working with NDoc and C# 2.0 for the last
couple days. It uses a lot of obsolete functions
(mostly in reflection and XML stuff) but it still works
fine for the most part. I did however find an issue
when it comes to generating documentation for generics.
The name of a generic is null and this results in a
NullReferenceException. A quick hack that can fix this
is to make the following change in ReflectionEngine.cs:

private string GetTypeName(Type type)
{
if(type.FullName == null)
{
return "T";
}
else
{
return type.FullName.Replace('+', '.').Replace("&",
null).Replace('+', '#');
}
}

Though not very elegant it works. To create a
description for T you'll have to create a class called
T or else the link just results in a 404.

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.