kOS.Suffixed.VesselTarget.GetModulesNamed C# (CSharp) Method

GetModulesNamed() private method

private GetModulesNamed ( StringValue modName ) : ListValue
modName StringValue
return ListValue
        private ListValue GetModulesNamed(StringValue modName)
        {
            // This is slow - maybe there should be a faster lookup string hash, but
            // KSP's data model seems to have not implemented it:
            IEnumerable<PartModule> modules = Vessel.parts
                .SelectMany(p => p.Modules.Cast<PartModule>()
                .Where(pMod => String.Equals(pMod.moduleName, modName, StringComparison.CurrentCultureIgnoreCase)));

            return PartModuleFieldsFactory.Construct(modules, Shared);
        }