|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | +using System; |
| 4 | + |
| 5 | + |
| 6 | +namespace System.Reflection.Metadata.ApplyUpdate.Test.ReflectionAddNewType; |
| 7 | + |
| 8 | +public interface IExistingInterface { |
| 9 | + public string ItfMethod(int i); |
| 10 | +} |
| 11 | + |
| 12 | +public struct QExistingStruct |
| 13 | +{ |
| 14 | +} |
| 15 | + |
| 16 | +public enum FExistingEnum { |
| 17 | + One, Two |
| 18 | +} |
| 19 | + |
| 20 | +public class ZExistingClass |
| 21 | +{ |
| 22 | + public class PreviousNestedClass { |
| 23 | + public static DateTime Now; // make the linker happy |
| 24 | + public static ICloneable C; |
| 25 | + public event EventHandler<string> E; |
| 26 | + public void R() { E(this,"123"); } |
| 27 | + } |
| 28 | + public class NewNestedClass {}; |
| 29 | + |
| 30 | + |
| 31 | + public string NewMethod (string s, int i) => s + i.ToString(); |
| 32 | + |
| 33 | + // Mono doesn't support instance fields yet |
| 34 | +#if false |
| 35 | + public int NewField; |
| 36 | +#endif |
| 37 | + |
| 38 | + public static DateTime NewStaticField; |
| 39 | + |
| 40 | + public static double NewProp { get; set; } |
| 41 | +} |
| 42 | + |
| 43 | +[AttributeUsage(AttributeTargets.All, AllowMultiple=true, Inherited=false)] |
| 44 | +public class CustomNoteAttribute : Attribute { |
| 45 | + public CustomNoteAttribute(string note) {Note = note;} |
| 46 | + |
| 47 | + public string Note; |
| 48 | +} |
| 49 | + |
| 50 | +[CustomNote("123")] |
| 51 | +public class NewToplevelClass : IExistingInterface, ICloneable { |
| 52 | + public string ItfMethod(int i) { |
| 53 | + return i.ToString(); |
| 54 | + } |
| 55 | + |
| 56 | + [CustomNote("abcd")] |
| 57 | + public void SomeMethod(int x) {} |
| 58 | + |
| 59 | + public virtual object Clone() { |
| 60 | + return new NewToplevelClass(); |
| 61 | + } |
| 62 | + |
| 63 | + public class AlsoNested { } |
| 64 | + |
| 65 | + [CustomNote("hijkl")] |
| 66 | + public float NewProp {get; set;} |
| 67 | + |
| 68 | + public byte[] OtherNewProp {get; set;} |
| 69 | + |
| 70 | + public event EventHandler<string> NewEvent; |
| 71 | + public event EventHandler<byte> OtherNewEvent; |
| 72 | +} |
| 73 | + |
| 74 | +public class NewGenericClass<T> : NewToplevelClass { |
| 75 | + public override object Clone() { |
| 76 | + return new NewGenericClass<T>(); |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +public struct NewToplevelStruct { |
| 81 | +} |
| 82 | + |
| 83 | +public interface INewInterface : IExistingInterface { |
| 84 | + public int AddedItfMethod (string s); |
| 85 | +} |
| 86 | + |
| 87 | +public enum NewEnum { |
| 88 | + Red, Yellow, Green |
| 89 | +} |
0 commit comments