I think it depends what brand and what OS it is running.
Cisco devices run their own proprietary version of IOS, which as far as I know doesn't support custom applications.
Juniper, on the other hand, is running JunOS based on FreeBSD, so there might be some chance, but I think it will be limited at best.
Some small companies may use something like embedded linux, since they probably won't develop their own system.
To sum it up, it depends on the manufacturer and what OS are they using. But even if you can develop application, it will have very limited resources, as network devices are designed specifically for their function and many features use special hardware instead of software (especially on switch).