1. 程式人生 > >c#讀取.resx/.resource資原始檔

c#讀取.resx/.resource資原始檔

            try {
                reader.GetResourceData(Key, out resourcetype, out resourcedata);
                //去掉第一個位元組,無用
                byte[] arr = new byte[resourcedata.Length - 1];
                for (int i = 0; i < arr.Length; i++) {
                    arr[i] = resourcedata[i + 1];
                }
                result = System.Text.Encoding.UTF8.GetString(arr);
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally {
                reader.Close();
            }