Is there a way to control CSharpCodeProvider's output? for instance:
string GetMapTypeStr() {
Type incompleteMap = typeof(Dictionary<,>)
CodeTypeReference incompleteMapCodeTypeRef = new CodeTypeReference(incompleteMap);
var p = new CSharpCodeProvider();
return p.GetTypeOutput(incompleteMapCodeTypeRef);
}
The above code returns "System.Collections.Generic.Dictionary<, >", but I want to return "Dictionary<T1,T2>" instead (mind e.g. spaces and T1 and T2).
I currently use string manipulations, but isn't there a way to coerce this pattern over the default, avoiding string operations?
Maybe I can inherit CSharpCodeProvider and override certain method.. but which and how?
Aucun commentaire:
Enregistrer un commentaire