I'm using the exhibited code to extract all method signatures from a .cs file that in this use case contains 2 declarations of the same class, but in different namespaces like this, in one file:
namespace CrossCut.Cache.Api.Services{ public partial class CacheServices}namespace CrossCut.Cache.Api.Services.V4{ public class CacheServices}...When I use this code to extract all the method signatures contain in both namespaces:
namespace CrossCut.Cache.Api.Services{ public partial class CacheServices}namespace CrossCut.Cache.Api.Services.V4{ public class CacheServices}...When I use this code to extract all the method signatures contain in both namespaces:
cs public static void Execute(string filePath, bool sort) { var methods = new List<MethodInfoProvider>(); if (!FilePathValidator.ValidateClassFilePath(filePath)) { Console.WriteLine($"Invalid class file path: {filePath}"); return; } var reader = new SourceFileReader(); var classes = reader.ReadClasses(filePath); foreach (var cls in classes) { methods.AddRange(cls.Methods); var sigs = methods.Select(m => m.Signature); if (sort) { sigs = sigs.OrderBy(s => s); } foreach (var sig in sigs) { Console.WriteLine($"V3,'{filePath}','{cls.NamespaceName}','{cls.ClassName}','{sig}'"); } } }
I get duplicate signature strings in the output, while there are no such duplicates in the actual code:
I get duplicate signature strings in the output, while there are no such duplicates in the actual code:
sh "CacheServices.V4.cs","Cache.Api.Services.V4","CacheServices","pbrsc(svch cch, IdValidationResponse responseCache, LogHelper logHelper)" "CacheServices.V4.cs","Cache.Api.Services.V4","CacheServices","pbrsc(svch cch, IdValidationResponse responseCache, LogHelper logHelper)" "CacheServices.V4.cs","Cache.Api.Services.V4","CacheServices","pbrsc(svch cch, Lineage.LineageSearchResponse responseCache, LogHelper logHelper)" "CacheServices.V4.cs","Cache.Api.Services.V4","CacheServices","pbrsc(svch cch, Lineage.LineageSearchResponse responseCache, LogHelper logHelper)" ``` I can't figure why there are duplicates in the console outout, but not in the file. There couldn't be in the file, or it would not compile.