© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
15 replies
_populous_

✅ How can i turn this into a query?

Current code:
foreach (var type in module.Types)
{
if (type.Name == "foo")
{
foreach (var method in type.Methods)
{
if (method.Name == "bar")
MethodDefinition myMethod = method;
}
}
}

I am trying to turn this code into a query, so it's shorter and prettier.. but i can't seem to get it right..
MethodDefinition myMethod =
from type module.Types
where type.Name == "foo"
...
I just get errors with whatever i try..
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

How can i turn this to a c++
C#CC# / help
4y ago
how can i write logic like this into a forloop?
C#CC# / help
3y ago
any idea on how to turn this code into a desktop app ?
C#CC# / help
2y ago