From bc9b64b8070f5592502dc31b3b1b370a5c51e5d3 Mon Sep 17 00:00:00 2001 From: Maxim Lipnin Date: Mon, 21 Oct 2019 11:51:52 +0300 Subject: [PATCH] Get resource string --- mcs/class/System.Data/corefx/Odbc/Res.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mcs/class/System.Data/corefx/Odbc/Res.cs b/mcs/class/System.Data/corefx/Odbc/Res.cs index 06ba2bdaa0c..2455fc8b87b 100644 --- a/mcs/class/System.Data/corefx/Odbc/Res.cs +++ b/mcs/class/System.Data/corefx/Odbc/Res.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.Resources; +using System.Reflection; // needed for ../referencesource/System.Data/System/Data/CodeGen/datacache.cs internal static partial class Res @@ -41,5 +43,13 @@ internal static partial class Res internal static partial class SR { - public static string GetResourceString(string resourceKey, string defaultString) => defaultString; + public static string GetResourceString(string resourceKey, string defaultString) { + Type fieldType = typeof(SR); + FieldInfo field = fieldType.GetField(resourceKey); + if (field != null) { + return field.GetValue(null).ToString(); + } + + return defaultString; + } } \ No newline at end of file -- 2.11.4.GIT