| 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 | |
| 53 var method = target.GetMethod; | 50 var method = target.GetMethod; |
| 54 #endif | |
| 55 return method != null && method.IsPublic ? method : null; | 51 return method != null && method.IsPublic ? method : null; |
| 56 } | 52 } |
| 57 | 53 |
| 58 /// <summary> | 54 /// <summary> |
| 59 /// Returns the public setter of a property, or null if there is no such
setter | 55 /// Returns the public setter of a property, or null if there is no such
setter |
| 60 /// (either because it's write-only, or the setter isn't public). | 56 /// (either because it's write-only, or the setter isn't public). |
| 61 /// </summary> | 57 /// </summary> |
| 62 internal static MethodInfo GetSetMethod(this PropertyInfo target) | 58 internal static MethodInfo GetSetMethod(this PropertyInfo target) |
| 63 { | 59 { |
| 64 #if DOTNET35 | |
| 65 var method = target.GetSetMethod(); | |
| 66 #else | |
| 67 var method = target.SetMethod; | 60 var method = target.SetMethod; |
| 68 #endif | |
| 69 return method != null && method.IsPublic ? method : null; | 61 return method != null && method.IsPublic ? method : null; |
| 70 } | 62 } |
| 71 } | 63 } |
| 72 } | 64 } |
| OLD | NEW |