I am creating a C# class as per:
http://msdn.microsoft.com/en-us/library/x6h10s6x.aspx
however I want my own 'return' rather than the return default(int);
it automatically generates. I know I can insert my own text using an EditPoi开发者_JS百科nt i.e
editPoint.Insert("return records.AsEnumerable<" + tableNameAsSingular + ">();");
but it still tries to stick in its own 'return' too
A workaround can be to delete of the default content of the method:
TextPoint startPoint = method.GetStartPoint(vsCMPart.vsCMPartBody);
TextPoint endPoint = method.GetEndPoint(vsCMPart.vsCMPartBody);
var editPoint = startPoint.CreateEditPoint();
editPoint.Delete(endPoint);
This code should erase the default content of the method.
In CodeDOM, there is something like CodeMethodReturnStatement. There may be something similar in VS code generation extensibility.
精彩评论