Class B seems redundant, you could simplify this to something like:
namespace oops1
{
class Program
{
static void Main(string[] args)
{
string strdetail = "Anurag Nayak 8585916787";
string[] details = strdetail.Split(' ');
API p = new API(details);
}
}
public class API
{
public string Firstname
{
get;
set;
}
public string Lastname;
{
get;
set;
}
public string Mobilenum;
{
get;
set;
}
public API(string [] details)
{
Firstname = details[0];
Lastname = details[1];
Mobilenum = details[2];
}
}
}
You can now print any of the fields with a statement such as
Console.WriteLine("name is: {0} {1}", p.Firstname, p.Lastname);