I can't figure out why it's looking for something static:

public class DatabaseBase
{
    private readonly string connectionString;

    public DatabaseBase(string connectionString)
    {
        this.connectionString = connectionString;
    }
}

public class MyDB : DatabaseBase
{
    readonly string connectionString = ConfigurationManager.AppSettings["MyConnectionString"];

    public MyDB() : base(connectionString)
    {          
    }
}


I get Cannot access non-static field 'connectionString' in static context.  I don't see anything static in the base Database class so why??

here's another example of when we did kinda the same thing:

partial class Database : DatabaseBase
{
    static string DbConnectionString
    {
        get
        {
            if (dbConnectionString == null)
                dbConnectionString = 
                    ConfigurationManager.AppSettings["MyConnectionString"];
            return dbConnectionString;
        }
    }
    public Database() :base(DbConnectionString)
    {
    }


ok so why did it have to be a static string for the connection string to be passed?


Question: Reliable way of detecting whether an Android app is running in 'BlueStacks'
Answer: I was also looking for a solution to this, I found this code snippet on some chinese blog when searching, I cant make out what its doing but maybe someone else can?

  public boolean isEmulator() {
        String android_id = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
        Log.d("ares","ANDROID_ID: "+android_id);
        Log.d("ares","Build.PRODUCT: "+Build.PRODUCT); 
        boolean emulator = TextUtils.isEmpty(android_id) || "google_sdk".equals( Build.PRODUCT ) || "sdk".equals(Build.PRODUCT);            
        return emulator;
    }


Please ignore if its totally no help...