OLD | NEW |
1 #region Copyright notice and license | 1 #region Copyright notice and license |
2 // Protocol Buffers - Google's data interchange format | 2 // Protocol Buffers - Google's data interchange format |
3 // Copyright 2015 Google Inc. All rights reserved. | 3 // Copyright 2015 Google Inc. All rights reserved. |
4 // https://developers.google.com/protocol-buffers/ | 4 // https://developers.google.com/protocol-buffers/ |
5 // | 5 // |
6 // Redistribution and use in source and binary forms, with or without | 6 // Redistribution and use in source and binary forms, with or without |
7 // modification, are permitted provided that the following conditions are | 7 // modification, are permitted provided that the following conditions are |
8 // met: | 8 // met: |
9 // | 9 // |
10 // * Redistributions of source code must retain the above copyright | 10 // * Redistributions of source code must retain the above copyright |
(...skipping 29 matching lines...) Expand all Loading... |
40 /// targeting the newer releases, .NET Core etc. | 40 /// targeting the newer releases, .NET Core etc. |
41 /// </summary> | 41 /// </summary> |
42 internal static class PropertyInfoExtensions | 42 internal static class PropertyInfoExtensions |
43 { | 43 { |
44 /// <summary> | 44 /// <summary> |
45 /// Returns the public getter of a property, or null if there is no such
getter | 45 /// Returns the public getter of a property, or null if there is no such
getter |
46 /// (either because it's read-only, or the getter isn't public). | 46 /// (either because it's read-only, or the getter isn't public). |
47 /// </summary> | 47 /// </summary> |
48 internal static MethodInfo GetGetMethod(this PropertyInfo target) | 48 internal static MethodInfo GetGetMethod(this PropertyInfo target) |
49 { | 49 { |
| 50 #if DOTNET35 |
| 51 var method = target.GetGetMethod(); |
| 52 #else |
50 var method = target.GetMethod; | 53 var method = target.GetMethod; |
| 54 #endif |
51 return method != null && method.IsPublic ? method : null; | 55 return method != null && method.IsPublic ? method : null; |
52 } | 56 } |
53 | 57 |
54 /// <summary> | 58 /// <summary> |
55 /// Returns the public setter of a property, or null if there is no such
setter | 59 /// Returns the public setter of a property, or null if there is no such
setter |
56 /// (either because it's write-only, or the setter isn't public). | 60 /// (either because it's write-only, or the setter isn't public). |
57 /// </summary> | 61 /// </summary> |
58 internal static MethodInfo GetSetMethod(this PropertyInfo target) | 62 internal static MethodInfo GetSetMethod(this PropertyInfo target) |
59 { | 63 { |
| 64 #if DOTNET35 |
| 65 var method = target.GetSetMethod(); |
| 66 #else |
60 var method = target.SetMethod; | 67 var method = target.SetMethod; |
| 68 #endif |
61 return method != null && method.IsPublic ? method : null; | 69 return method != null && method.IsPublic ? method : null; |
62 } | 70 } |
63 } | 71 } |
64 } | 72 } |
OLD | NEW |