Answer the question
In order to leave comments, you need to log in
How to transfer DllImport from MainForm.cs to another file?
There is a code:
public partial class MainForm : Form
{
[DllImport("bass.dll")]
public static extern bool BASS_Init(int device,int freq,int flags,int win,int clsid);
[DllImport("bass.dll")]
public static extern int BASS_StreamCreateFile( bool mem,string file,int offset,int lenght,int flags);
Answer the question
In order to leave comments, you need to log in
Well, firstly, you can create a separate static class and write everything there.
And secondly, if you still want external functions to still be in the MainForm class, then it is not for nothing that the word partial is indicated in the class declaration. It says that you can describe a class in multiple files. To do this, you can create a new file, start it the same way: public partial class MainForm, and put external functions into it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question