CustomAttributeDelete.cs 1.2 KB
Newer Older
1 2 3 4 5 6 7
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;


namespace System.Reflection.Metadata.ApplyUpdate.Test
{
8
    [AttributeUsage (AttributeTargets.Method | AttributeTargets.Class, AllowMultiple=true)]
9 10 11 12 13 14 15 16 17 18 19 20 21
    public class MyDeleteAttribute : Attribute
    {
        public MyDeleteAttribute (string stringValue) { StringValue = stringValue; }

        public MyDeleteAttribute (Type typeValue) { TypeValue = typeValue; }

        public MyDeleteAttribute (int x) { IntValue = x; }

        public string StringValue { get; set; }
        public Type TypeValue {get; set; }
        public int IntValue {get; set; }
    }

22
    [MyDeleteAttribute ("xyz")]
23 24 25 26 27 28 29 30 31 32 33 34 35 36
    public class ClassWithCustomAttributeDelete
    {
        [MyDeleteAttribute ("abcd")]
        public static string Method1 () => null;

        [MyDeleteAttribute (typeof(Exception))]
        public static string Method2 () => null;

        [MyDeleteAttribute (42, StringValue = "hijkl", TypeValue = typeof(Type))]
        [MyDeleteAttribute (17, StringValue = "", TypeValue = typeof(object))]
        public static string Method3 () => null;

    }
}