I thought I should add my two pence. Before I say what I suggest you do, I thought I should give a bit of perspective from a male point of view. The first thing that people need to understand is that men also get harassed by men, just usually not in a sexual context.

Sadly there are many men out there, that have this need to be "alpha" with all the stupid connotations this term carries. There is a term that describe them, its "bully". I am a very  polite person by upbringing, and I had similar situations but in a "manhood" context. Comments implying that I am weak, gay or whatnot. Because of my polite upbringing I had a huge fear of confrontation.

Sidetrack: This is actually a very interesting thing. Our whole set of defensive mechanisms are completely useless for everyday situations. Being afraid of confrontations means having your blood concentrating in the back of your brain and having a very strong urge to act (which normally is to run away from the imminent danger), but you know that this is completely stupid so you don't. However your frontal lobe is already out. So you stand there, frozen in limbo without being able to register properly the situation.

OK, back on track. I have tried few different ways to deal with similar situations and I found that the most efficient way to deal with it is by confrontation. After a lot of effort and emotional pain, I managed to get over my fear of confrontation. There is no easy way to do that. You have to confront people. The way I think about it, is the I am nice and polite, but if you poke me, I will bite you. I find it to be a very useful mental image to have. The whole point is to accept that you have to make hurtful comments. I know how it sounds, believe me. For many years I thought this was wrong. But it's not. If someone punches you, you have the right to punch back. So, If someone is a dick to you, you have the right to be a dick back.

However! You have to learn to do this in a calm and cold matter. This shocks people. If you get worked up and you start yelling, the game is lost. For example in your case a respond could have been "Maybe I am, how is this any of your business?". I understand that this is hard to come up with at the moment, but there are a couple of comments that can get used universally:

- If I valued your opinion on [insert subject], I would have asked for it.

- I'm sorry, you must have mistaken me with someone that finds you funny.

You need to say this coldly and dryly and just move on. This usually stuns people. If not, if he tries to top it up somehow just say "Not interested" and walk away.

I find that after that they usually come and say that it was a joke and that I shouldn't take it seriously etc. This is an attempt to manipulate you emotionally by putting the blame on you. I find that the most effective thing is to say "I am a dull and humorless person that cares only about his work. But I'm sure you will find that if you treat me professionally we will get along just fine." and then just walk away. I find that it has a very powerful effect to walk away without letting them reply anything. Just ignore their answer.

You have to remember though, never to hold a grudge. Let past be the past. And don't be defensive. Not everyone is out to get you. I find this to be extremely effective and it actually people tend to respect you more.

I do understand that what I described is not something that many people can do naturally. I definitely couldn't. However I wished someone told me this earlier.

All the best.

*Added later*: I forgot the most important thing. Do not assume the role of the victim. This was a rude and annoying comment and that's all. Most probably he said this in an attempt to appear cool to you. Maybe even flirt. There exists this whole theory of flirt based on "negging" women that usually men do not understand how to use and end up just being rude.

I'm not saying this in order to excuse him. His motive doesn't matter, if you feel like he overstepped your boundary, enforce it. I'm just saying this to tell you not to be afraid.

And finally, don't be a bully. This may seem to contradict what I have written above, but it doesn't. Your replies should target only the behaviours that annoy you. Do not comment on his appearance, gender, wealth, irrelevant behaviour, etc. This should be a matter of principle, but it is also useful. Later if he realises that he was being rude to you, he will have nothing to hold it against you. So if he apologizes later, you should have nothing to apologize about.