As You Like It is an oft cited example of the pastoral literary convention employed in drama. Pastoral literature is defined as that which focuses on country life of shepherds and depicts it as ideal and sincere while contrasting it to court life (or urban, city life) that is depicted as artificial and corrupt. It is the contrast between the genuine and the corrupt that lends itself to social criticism and gives the poet opportunity to voice objections to the dangers, evils, and harm of courtly or city life in relation to rulers and affects of the environment and development of personal relationships.
As You Like It fits the definition in that the first setting is the court of the deposed Duke Senior, which is now controlled by the Duke's younger brother, Duke Frederick. The fact that the throne was usurped by a younger brother and the rightful ruler exiled is sufficient to illustrate the pastoral element of corruption of the court. In further acts of corruption, Rosaline and Orlando--in the midst of death threats--are also exiled from or endangered by the corrupt court of Duke Frederick.
The second setting is the pastoral land of Arden Forest where Rosaline and Celia (her companion in exile) meet shepherds and buy a cottage and sheep herd of their own. Shepherds and sheep are a definitive feature of the convention of the pastoral. That the principals meet and become shepherds is sufficient to illustrate the idyllic element in the pastoral. Further illustration of the idyllic are found in Orlando's proliferation of the forest with unschooled love poems. The resolution of the play further illustrates the idyllic when Rosaline/Ganymede properly arranges all the couples who blissfully marry and look forward to happiness under Duke Senior's reestablished rule.
The play offers a comparison between life at court and life in the Forest of Arden. Rosalind and Celia disguise themselves and move among the shepherds and other rustics, discussing love and other matters. Because the play begins with a number of unrequited relationships, the forest and the pastoral atmosphere it provides can be seen as a place where harmony is restored and romance is alive.
The idea of the simple pastoral life is one that pervades English literature: living among shepherds and sheep, gazing upon the fields, following the simple rhythms of nature are all seen as desirable idyllic mode of being, preferable to the stress and artificiality of city and court life. The pastoral is a very romanticized vision of human existence, idealized and not entirely realistic.