We report on magnetostriction measurements of YNi 2 B 2 C subjected to magnetic fields up to 8 T. Polycrystalline samples were prepared both by arc-melting and by melting under a 10 kV electron beam in high vacuum. While YNi 2 B 2 C is not magnetostrictive at higher temperatures, in the superconducting state all samples show the hysteresis in length change expected for a classical hard superconduutor. The location of the irreversibility line in the B-T phase diagram can be established from magnetostriction measurements. Using Bean's model in a derived form, we propose a field dependence of the critical current density to explain magnetostriction in the superconducting mixed state.