G
Guest
Hi,
class Resource // This class is autogenerated by Visual Studio.
{
internal static string M001
{
get{ return ResourceManager.GetString("M001"); }
}
}
public Main()
{
/*
Logging a message from resources.
If I hover the mouse over M001 in Visual Studio, the tooltip says
"Looks up a localized message similar to MESSAGE TEXT COMES HERE".
*/
LogMessage( Resource.M001 );
}
public LogMessage( ?SomeType? param )
{
/******
I don't want to get "param" as a string here. Instead, I want to
get the name of the property passed as a parameter to this method. Something
like:
******/
Console.Write( param.(MethodInfo or whatever).Name ); // Prints
"M001".
}
In other words, I want to:
- Pass a property (Resource.M001) to a method directly, as a C# identifier,
as this provides compiler type checking and context help.
- In the called method, I want to get the passed property's name ("M001"),
as this name contains encoded additional information about the string the
property retrieves from resources.
I wonder if the above is possible in C# 2.0.
Thanks
class Resource // This class is autogenerated by Visual Studio.
{
internal static string M001
{
get{ return ResourceManager.GetString("M001"); }
}
}
public Main()
{
/*
Logging a message from resources.
If I hover the mouse over M001 in Visual Studio, the tooltip says
"Looks up a localized message similar to MESSAGE TEXT COMES HERE".
*/
LogMessage( Resource.M001 );
}
public LogMessage( ?SomeType? param )
{
/******
I don't want to get "param" as a string here. Instead, I want to
get the name of the property passed as a parameter to this method. Something
like:
******/
Console.Write( param.(MethodInfo or whatever).Name ); // Prints
"M001".
}
In other words, I want to:
- Pass a property (Resource.M001) to a method directly, as a C# identifier,
as this provides compiler type checking and context help.
- In the called method, I want to get the passed property's name ("M001"),
as this name contains encoded additional information about the string the
property retrieves from resources.
I wonder if the above is possible in C# 2.0.
Thanks