Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Generics IDatabase数据库=新的T();a=数据库。选择(新查询(“something1”、“something2”、“something3”);返回a;}Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。L_Generics_Variables - Fatal编程技术网

Generics IDatabase数据库=新的T();a=数据库。选择(新查询(“something1”、“something2”、“something3”);返回a;}Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。L

Generics IDatabase数据库=新的T();a=数据库。选择(新查询(“something1”、“something2”、“something3”);返回a;}Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。L,generics,variables,Generics,Variables,IDatabase数据库=新的T();a=数据库。选择(新查询(“something1”、“something2”、“something3”);返回a;}Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。Linq命名空间:Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。Linq命名空间: public class foo { private string a; private i


IDatabase数据库=新的T();a=数据库。选择(新查询(“something1”、“something2”、“something3”);返回a;}Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。Linq命名空间:Select似乎不是IList的有效方法,您可以进一步说明吗?Select是在系统内声明的扩展方法。Linq命名空间:
public class foo
{
    private string a;
    private int b;
    private int c;
}
public string GetA<T>() where T: IDatabase
{
   //example might be GetA<RESTful>();
}

public int GetB<T>() where T: IDatabase
{
   //example might be GetB<MySQL>();
}
public object GetValue<T>(the class variable I want to query) where T: IDatabase
{
    //query database using type T and return it to the variable specified
}
public interface IDataProvider<T>
{
    T Get()
}
public class FootRestProvider : IDataProvider<Foo>
{
    public Foo Get()
    {
        // implement logic to get foos from rest
     }
}

public class FooMySqlProvider : IDataProvider<Foo>
{
    public Foo Get()
    {
        // implement logic to get foos from mysql
    }
}   
public class FooMerger
{
    // fill this list from constructor
    private IList<IDataProvider<Foo>> providers;

    public Foo Get()
    {
        var foosToMerge = providers.Select( x => x.Get() ).

        // implement merging logic here 
    }
}
public void GetValue<T>(string property) where T: IDatabase, new()
{
    IDatabase database = new T();
    database.RegisterObserver(this);

    string FROM = typeof(theCurrentClass).Name;
    string SELECT = editProperty = property;
    string WHERE = "1";

    database.Select(new Query(SELECT, FROM, WHERE));        
}

private string fieldName;  //contains the name of the field I want to edit

void IObserver.Update(object data)
{       
    FieldInfo field = this.GetType().GetField(fieldName, BindingFlags.NonPublic | BindingFlags.Instance);

    if(field != null)
    {
        field.SetValue(this, data);         
    }
}