This paper is concerned with the power dispatch problem of distributed generators (DGs) for optimal operation of a microgrid. The objective is to minimize the fuel cost during the grid-connected operation, while ensuring stable operation after islanding. To achieve this goal, the economic dispatch (ED) problem and related constraints are formulated. The constraints considered in this study are: i) reserve for variation in load demand, ii) reserve for variation in the power outputs of non-dispatchable DGs, iii) flow limits between two adjacent areas, and iv) reserve for the stable islanded operation. The first three constraints, which have been employed in ED problem for conventional power systems, are modified to apply to Microgrids. We also provide a detailed formulation of the constraint for stable islanded operation in accordance with two power-sharing principles: i) fixed droop and ii) adjustable droop. The problem is solved using a modified direct search method, and the effect of the constraints on the operational cost is investigated via numerical simulations.