Sea hares are very effective at eating most types of algae, although not all of them, so do research this beforehand.
As opposed to Nudibranches they have an internal shell for protection. Furthermore, they will release a kind of ink when feeling threatened. This is not poisonous, but should be removed by changing the water.
Sea hares require a great deal of algae to survive, so it is advisable to pass it on when its task is accomplished. When it dies, a large amout of nutients are released to the water, so it must not be kept too long without sufficient algae.
Most species are easy to keep in an aquarium as long as there are enough algae, although some species do have slightly more specific food requirements.