diff options
Diffstat (limited to 'csharp/src/Google.Protobuf/Compatibility')
-rw-r--r-- | csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs | 8 | ||||
-rw-r--r-- | csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs b/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs index 8a6fefa7..e3914dd3 100644 --- a/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs +++ b/csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs @@ -47,7 +47,11 @@ namespace Google.Protobuf.Compatibility /// </summary> internal static MethodInfo GetGetMethod(this PropertyInfo target) { +#if DOTNET35 + var method = target.GetGetMethod(); +#else var method = target.GetMethod; +#endif return method != null && method.IsPublic ? method : null; } @@ -57,7 +61,11 @@ namespace Google.Protobuf.Compatibility /// </summary> internal static MethodInfo GetSetMethod(this PropertyInfo target) { +#if DOTNET35 + var method = target.GetSetMethod(); +#else var method = target.SetMethod; +#endif return method != null && method.IsPublic ? method : null; } } diff --git a/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs b/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs index 762a29eb..fe9cda8d 100644 --- a/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs +++ b/csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs @@ -49,6 +49,11 @@ namespace Google.Protobuf.Compatibility /// Returns true if the target type is a value type, including a nullable value type or an enum, or false /// if it's a reference type (class, delegate, interface - including System.ValueType and System.Enum). /// </summary> +#if DOTNET35 + internal static bool IsValueType(this Type target) { + return target.IsValueType; + } +#else internal static bool IsValueType(this Type target) { return target.GetTypeInfo().IsValueType; @@ -109,5 +114,6 @@ namespace Google.Protobuf.Compatibility } return null; } +#endif } } |