CSOM connect SharePoint Online demo(need add Microsoft.SharePointOnline.CSOM reference):
15410-code.txt
More reference:
https://www.c-sharpcorner.com/article/connect-to-sharepoint-2013-online-using-csom-with-console-ap/
-----------------------
Updated-------------------------
You could try the way in this blog:https://www.spguides.com/the-remote-server-returned-an-error-407-proxy-authentication-required/
After you run the code, you can restore these settings.