Consider the following:
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue)]
public class NotNullAttribute : Attribute
{
}
public class Class1
{
[return: NotNull]
public static string TestMethod([NotNull] string arg)
{
return arg + " + " + arg;
}
}
How, using System.Reflection, would you see that the NotNullAttribute attribute had been applied to the return value of the method? If you can't, what is the purpose behind the [return: ] syntax?