I've created a class that is comprised mostly of functions. Some of the
functions in the class have a custom attribute class defined. The
constructor of this attribute class takes a single argument unique to each
function. I'm trying to create a Linq query that will 1) only look at the
functions with this custom attribute defined and 2) return the function that
is defined with custom attribute class that contains a value I'm looking for
var qry = from method in type.GetMethods()
where method.MethodAttributes
The above is what I've started with but I'm not sure where to take it from
here.
TIA
.
> I've created a class that is comprised mostly of functions. Some of the
> functions in the class have a custom attribute class defined. The
[quoted text clipped - 8 lines]
> The above is what I've started with but I'm not sure where to take it from
> here.
var query = from method in type.GetMethod()
from MyAttribute attr in
method.GetCustomAttributes(typeof(MyAttribute), false)
where attr.Whatever == "My value"
select method;
Untested, but it should work :)

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
eric - 19 Feb 2008 20:12 GMT
Thank you much.
>> I've created a class that is comprised mostly of functions. Some of the
>> functions in the class have a custom attribute class defined. The
[quoted text clipped - 21 lines]
>
> Untested, but it should work :)