Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to use Environment.GetResourceString static method

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = Environment.GetResourceString("test"); //compile-time error
        }
    }
}

The error is: 'System.Environment' does not contain a definition for 'GetResourceString'.

EDIT: OP has stated that he's using the Compact Framework, v3.5.

I dont get the picture, what's wrong with my code? Thanks!

like image 691
Stringer Avatar asked Dec 09 '22 18:12

Stringer


1 Answers

Environment.GetResourceString is not public

internal static string GetResourceString(string key);

See Michael Petrottas answer for how to access resources or have a look at the samples here http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx

like image 122
Simon Avatar answered Dec 23 '22 19:12

Simon