We report on a new simple route to realize a high resolution nanograting. By adopting an InAlGaAs matrix and strain-compensated technique, we have proved that a uniform self-assembled InAs nanowire array can be fabricated by molecular beam epitaxy (MBE). A nanograting woven by self-assembled semiconductor nanowires shows a conspicuous diffraction feature. The good agreement between the theoretical and experimental values of diffraction peak positions indicates that a uniform nanowire array is a promising nanograting. This simple one-step MBE growth method will open exciting opportunities for the field of clever optics design.