In DC it's only illegal to ride on the sidewalks in a very specific, downtown business district that's marked by a lot of pedestrian traffic.
I wouldn't say it's all that safe on the street in DC. I've very nearly been run over by cars (especially cabs) that want to turn right out of a circle (which even has a bike lane).