在我的应用程序中,我注意到我有大约 30 个全局变量。它是糟糕的编程和击球方式是使用函数传递给变量还是没关系?
这是我所有 globat 变量的列表public partial class MainWin : Form
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
NetworkAdapter selectedAdapter = null;
string lastPath = "";
int _selectedIndex;
bool bContinuePlay;
bool ifContinue = true;
decimal delay = 10;
int delayBetweenLoops;
ManualResetEvent manualResetEvent = new ManualResetEvent(false);
BackgroundWorker backGroundWorker = null;
bool isBurst = true;
IpV4Address oldIpAddress;
IpV4Address newIpAddress;
ushort oldPort;
ushort newPort;
MacAddress oldMacAddress;
MacAddress newMacAddress;
bool fixBadChecksum = false;
bool removePPPOE = false;
bool removeVlan = false;
bool fragmentation = false;
private DateTime lastCheck = DateTime.MinValue;
bool continuePlay = true;
RangeFinder range = null;
IpV4Address oldRangeIp;
IPAddress newRangeIpStart;
int loopsCount;
decimal numberOfLoops;
double playSpeed;
string path = "";
bool isError = false;