I don't want to know your gender. I don't care. It's your thing. It's non of my business, and it makes no difference to me whatsoever.
If I do want to know your gender, then things between us are starting to become intimate.
To sum things up: I would say it's rude if someone shares his gender identity with me without being asked. On the same level as if someone shares his/her dick size without being asked.