Skip to content

Commit 249d04f

Browse files
committed
Refactor GetMethod to streamline method retrieval and eliminate unnecessary filtering
1 parent 4fe7eda commit 249d04f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/BitzArt.XDoc/Utility/XmlParser.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,14 @@ private FieldDocumentation ParseFieldNode(XmlNode node, string name)
9090

9191
private static MethodBase? GetMethod(Type type, string name, IReadOnlyCollection<string> parameters)
9292
{
93+
name = name.Replace("#ctor", ".ctor");
94+
9395
var methods = new List<MethodBase>();
9496
methods.AddRange(type.GetMethods());
9597
methods.AddRange(type.GetConstructors());
9698

97-
98-
name = name.Replace("#ctor", ".ctor");
99-
100-
var filterred = methods
99+
var method = methods
101100
.Where(method => method.Name == name)
102-
.ToList();
103-
104-
var result = filterred
105101
.Where(method =>
106102
{
107103
var methodParameters = method
@@ -123,7 +119,7 @@ private FieldDocumentation ParseFieldNode(XmlNode node, string name)
123119
})
124120
.SingleOrDefault();
125121

126-
return result;
122+
return method;
127123
}
128124

129125
private TDocumentation ParseMemberNode<TMember, TDocumentation>(string name, Func<Type, string, IReadOnlyCollection<string>, TMember?> getMember, Func<TMember, TDocumentation> getDocumentation)

0 commit comments

Comments
 (0)