I have a generic method that it takes a type T of a sapclient method but when I want to initialize it, it initializes as object instead of the actual class. How is it possible to initialize it and pass the username and password as it requires it?
public static Auth<T>(string username, string password) where T : new()
{
    T client = new T(binding, endpointAddress)
    client.ClientCredentials.UserName.UserName = username
    client.ClientCredentials.UserName.Password = password
}
I tried that code but it always gives an error saying
cannot create an instance of the variable type 'T'
 
     
    