void Swap<T>(ref T x, ref T y) {
T t = x;
x = y;
y = t;
}
var test = new[] { "0", "1" };
Swap(ref test[0], ref test[1]);
private bool IsValidSqlLite(string filepath)
{
byte[] signature = new byte[] { 0x53, 0x51, 0x4c, 0x69, 0x74, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x20, 0x33, 0x00 };
try
{
using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
for (int i = 0; i < signature.Length; ++i)
{
if ((byte)fs.ReadByte() != signature[i]) return false;
} // for i
return true;
} // using fs
} // try
catch { return false; } // catch
} // IsValidSqlLite
private bool AccordPressed;
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (this.AccordPressed && Keys.E == e.KeyCode) MessageBox.Show("Нажато CTRL-W, E");
this.AccordPressed = (e.Control && Keys.W == e.KeyCode);
}