Importing and Exporting Collection Data with Code

Does anyone know how to do this?