PRIMARY QUESTION
Can one get a unique id from a method name in the C# language
.....................................................................................
the method name is the name that can be passed to a c# delegate
(for this thread .. lets agree a method name is NOT a literal string wiht quotes such as "my_interesting_method")
How flexible is a delegate in terms of system reflection
Perhaps the unique id would be a string, perhaps an intergral type (int);
I am not trying to go from a string representation to method invocation .. at least unless I am forced to.
elided example (not compilable)
public class z2000
{
public static in method_sort_by_id() {};
public static string desired_experience()
{
string x = method_name_from_method(method_sort_by_id);
//above line is the first step in ideal experience .. improvements abound
//shortcoming .. not internationalized ... if the info was shown to users
return x;
}
public void actual_experience()
{
int primary_key = 222;//unique id as in relation db;
store_delegate_with_names(method_sort_by_id, "method_sort_by_id", "typical method to sort by id", primary_key");
//above line is moderately acceptable
}
}//end of class
Some Thoughts
Please correct me if I am wrong on some of these thoughts if necessary.
1. It seems that one can only pass method names to delegate constuction and no other c# constuction. (I am not referring to passing a string).
2. It seems that delegates can not be compared meaningfully.
3. It seems that the type info on the delegate returns the signature of the delegate in some form, which does not reveal the method name
4. It seems one can only invoke the method (or methods for invocation list) and not much deep reflection.
5. It seems that refection goes from string names to invocation .. and not vice versa
------------------------------------------------------------------------------
Any thoughts I hope this question is useful to someone else as well.
Thanks in advance.