Strange label after problem

I don't know enough about low-level LaTeX, but `\expandafter\string\expandafter\xdef\expandafter\string\csname #1\endcsname` with `#1`=`foo` expands to `\xdef\foo`, however inserting another `\expandafter` before `\csname` expands to `\def\csnamefoo\endcsname`, I haven't figured out how to insert a space after `\csname`, which would solve the problem that `\csxdef` might not exist…