http://dailydotnettips.com/2011/01/01/generate-method-stubs-using-shortcut-key-in-visual-studio/
just press "ctrl + ." and "Enter"
just press "ctrl + ." and "Enter"
Task.Run(() => doStuff("hello world"));2
Task.Factory.StartNew(() => doStuff("hello world"));3
ThreadPool.QueueUserWorkItem(a => doStuff("hello world"));4
void Example() { // Hook up the ProcessFile method to the ThreadPool. // Note: 'a' is an argument name. Read more on arguments. ThreadPool.QueueUserWorkItem(new WaitCallback(ProcessFile), a); } private void ProcessFile(object a) { // I was hooked up to the ThreadPool by WaitCallback. }
using (var db = new MyEntities()) { var Owner_ID = new ObjectParameter("Owner_ID", typeof(string)); var msgError = new ObjectParameter("msgError", typeof(string)); db.InsBeerClient(Owner_ID, msgError); return (msgError.Value ?? "").ToString(); }
using (var db = new EGAIS_RUEntities()) { db.Configuration.ValidateOnSaveEnabled = false; var _rec = new CONTRAGENT() { id = 1, status = 3 }; db.CONTRAGENTS.Attach(_rec); var entry = db.Entry(_rec); entry.Property(e => e.status).IsModified = true; db.SaveChanges(); }
db.Configuration.ValidateOnSaveEnabled = false;
dbcontext.Entry(_rec).State = System.Data.Entity.EntityState.Modified; dbcontext.SaveChanges();
public static X509Certificate2 GetCertFromCont(string pin, string CertCont) { CspParameters cspParameters = new CspParameters(75); cspParameters.KeyContainerName = CertCont; cspParameters.Flags = CspProviderFlags.NoPrompt; if (pin != "") { System.Security.SecureString s = new System.Security.SecureString(); foreach (char z in pin) s.AppendChar(z); cspParameters.KeyPassword = s; } try { Gost3410CryptoServiceProvider prov = new Gost3410CryptoServiceProvider( cspParameters); return prov.ContainerCertificate; } catch (Exception e) { //System.Windows.MessageBox.Show(e.Message); return null; } }