private void button1_Click(object sender, EventArgs e)
{
List<string> lstTest = new List<string>();
var thread = new Thread(Start);
thread.Start(lstTest);
}
private void Start(object obj)
{
List<string> lstTest = (List<string>)obj;
int count = lstTest.Count();
}
new Thread(Start);
// где
private void Start()
{
//...
}
try
{
sqlConnection.Open();
}
catch { }
class MyClass
{
public void Test();
}
// равнозначно
void Test(MyClass hiddenThis);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate int MultiplyByTen(int numberToMultiply);
IntPtr pDll = NativeMethods.LoadLibrary(@"PathToYourDll.DLL");
IntPtr pAddressOfFunctionToCall = NativeMethods.GetProcAddress(pDll, "MultiplyByTen");
MultiplyByTen multiplyByTen = (MultiplyByTen)Marshal.GetDelegateForFunctionPointer(
pAddressOfFunctionToCall,
typeof(MultiplyByTen));
int theResult = multiplyByTen(10);