WhereIfinputSpareNumberIsNotNullOrWhiteSpace x = xSpareNumber xToolNumber xSubstanceNumberContainsinputSpareNumber
The code provided is using the WhereIf extension method to conditionally filter a collection based on the value of the input.SpareNumber.
The WhereIf extension method takes two parameters: a condition and a predicate. If the condition is true, it applies the predicate to the collection, otherwise it returns the collection unchanged.
In this case, the condition is input.SpareNumber.IsNotNullOrWhiteSpace(), which checks if the input.SpareNumber is not null, empty, or consists only of white space characters.
The predicate in this case is a lambda expression: x => (x.SpareNumber || x.ToolNumber || x.SubstanceNumber).Contains(input.SpareNumber). This lambda expression checks if the input.SpareNumber is contained within the SpareNumber, ToolNumber, or SubstanceNumber properties of the objects in the collection.
Therefore, if the input.SpareNumber is not null, empty, or consists only of white space characters, the code will filter the collection to only include objects where the SpareNumber, ToolNumber, or SubstanceNumber properties contain the input.SpareNumber
原文地址: http://www.cveoy.top/t/topic/iDUH 著作权归作者所有。请勿转载和采集!