By SharePoint object model, how we can get all the sites with sub sites and the top-level sites alone separately.
The following snippet which returns all the sites and sub-sites from the site collection.
SPSite site=new SPSite.AllWebs;
and if we want only the top-level sites from the sitecollection, we have to call the SPWeb object.
and webs.Webs; returns the sub-sites from that particular web object.