jgshojr
February 9th, 2010, 10:43 AM
private IEnumerable<TypeInfo> SearchMethodsInLoadedAssemblies(
IEnumerable<Assembly> loadedAssemblies, string startText)
{
// Do not modify the following line.
startText = startText.ToLower();
// Todo:
// The SearchMethodsInLoadedAssemblies method of the AssemblyExplorerForm
// class extracts all the public members of each loaded assembly where the
// member's name starts with the startText parameter.
// The search is case insensitive. The method returns a strongly typed
// IEnumerable of TypeInfo objects with the TypeName and MemberName
// properties set to the respective properties from the extracted types and
// members.
return from items in loadedAssemblies
where items.GetTypes().SelectMany(item => item.Name.ToLower().StartsWith(startText))
select items;
// Hint:
// You can get all the types exposed by an assembly by calling the
// GetTypes method of the Assembly class.
// Hint:
// You can call SelectMany several times with different overloads and parameters
// to drill down through the types and members.
}
3.5, 2008.
I read the msdn library item (http://msdn.microsoft.com/en-us/library/bb534336.aspx) about using selectmany and followed their code example almost to the t, yet, it is not compiling, telling me to "Specify the arguments explicity". Help!
IEnumerable<Assembly> loadedAssemblies, string startText)
{
// Do not modify the following line.
startText = startText.ToLower();
// Todo:
// The SearchMethodsInLoadedAssemblies method of the AssemblyExplorerForm
// class extracts all the public members of each loaded assembly where the
// member's name starts with the startText parameter.
// The search is case insensitive. The method returns a strongly typed
// IEnumerable of TypeInfo objects with the TypeName and MemberName
// properties set to the respective properties from the extracted types and
// members.
return from items in loadedAssemblies
where items.GetTypes().SelectMany(item => item.Name.ToLower().StartsWith(startText))
select items;
// Hint:
// You can get all the types exposed by an assembly by calling the
// GetTypes method of the Assembly class.
// Hint:
// You can call SelectMany several times with different overloads and parameters
// to drill down through the types and members.
}
3.5, 2008.
I read the msdn library item (http://msdn.microsoft.com/en-us/library/bb534336.aspx) about using selectmany and followed their code example almost to the t, yet, it is not compiling, telling me to "Specify the arguments explicity". Help!