2014-08-13 10:39:27 +01:00
|
|
|
using System;
|
|
|
|
|
2014-09-04 09:07:35 +01:00
|
|
|
namespace TestAttributesCollecting
|
2014-08-13 10:39:27 +01:00
|
|
|
{
|
2014-09-04 09:07:35 +01:00
|
|
|
class A : Attribute
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
public partial class X
|
|
|
|
{
|
2014-09-04 09:07:35 +01:00
|
|
|
[A]
|
|
|
|
partial void Foo<[A] T>(/*[A]*/ int p);
|
2014-08-13 10:39:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public partial class X
|
|
|
|
{
|
2014-09-04 09:07:35 +01:00
|
|
|
partial void Foo<T> (int p)
|
2014-08-13 10:39:27 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 09:07:35 +01:00
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
public partial class Y
|
|
|
|
{
|
|
|
|
partial void Foo ()
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
}
|
|
|
|
}
|
2014-09-04 09:07:35 +01:00
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
public partial class Y
|
|
|
|
{
|
|
|
|
[CLSCompliant (true)]
|
|
|
|
partial void Foo ();
|
|
|
|
}
|
|
|
|
|
|
|
|
class Program
|
|
|
|
{
|
|
|
|
public static int Main ()
|
|
|
|
{
|
2014-09-04 09:07:35 +01:00
|
|
|
var m = typeof (X).GetMethod ("Foo", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
|
|
|
|
var x = m.GetCustomAttributes (true);
|
2014-08-13 10:39:27 +01:00
|
|
|
Console.WriteLine (x.Length);
|
|
|
|
if (x.Length != 1)
|
|
|
|
return 1;
|
|
|
|
|
2014-09-04 09:07:35 +01:00
|
|
|
var ga = m.GetGenericArguments ();
|
|
|
|
x = ga [0].GetCustomAttributes (false);
|
|
|
|
if (x.Length != 1)
|
|
|
|
return 2;
|
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
x = typeof (Y).GetMethod ("Foo", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetCustomAttributes (true);
|
|
|
|
Console.WriteLine (x.Length);
|
|
|
|
if (x.Length != 1)
|
2014-09-04 09:07:35 +01:00
|
|
|
return 3;
|
|
|
|
|
2014-08-13 10:39:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|