He famously wrote this line in his play Lady Windermere's Fan, spoken by the character Lord Darlington.
While this quote is often misattributed to other figures like Mark Twain or Groucho Marx, it is definitively attributed to Wilde.