It's complicated by the fact he is a military officer. Adultery especially by officers is seen as unbecoming conduct and a threat to military discipline.
That is correct and thank you as I was being unclear. I was intending to reply only to the question of why this is a matter for public comment; I do not believe given the information so far presented that he acted illegally. I'm not even convinced there was any real basis for resignation if he still had the respect of his peers and the confidence of the President.
Still, in my view, and I think in the view of many others, "flag" officers never really retire. And as such his behavior in this matter brings disgrace to the service and uniform. For me, it is just another recent example that really calls into question the ethics of an entire generation of our military. Patraeus, Ward, Sinclair, Allen, McChrystal, the list goes on and on.