Select diagonal

I know with B we can select in a square but would it be also possible to select in a diagonal line for example a triangle.

If you mean that with Border select you get rectangular selection and you’d like to get triangle like selection instead then no, there isn’t way to do exactly triangle.

You can use Lasso select instead which allows free selection drawing. In 2.79 this is Ctrl+left click in viewport. In 2.8 tweaking with right click and drag an area should do the same, though it appears to interfere with Right click menu (for me it works with Ctrl+right click).