I'm trying to create a command with which to write
\declaremathoperator{ABC}
to get
\def\ABC{\operatorname{ABC}}
I tried to implement it like
\def\declaremathoperator#1
{ \def\csname #1\endcsname{\operatorname{#1}} }
but it doesn't work: Use of \csname doesn't match its definition.
It seems to me that the solution, if it exists, should be based on writing \#1, but at the same time so that TeX first makes a substitution of #1, and only then would begin to consider \ as the beginning of the command name.