public MyCallbakActivity() { Implementation = () => new Sequence() { Variables = { v }, Activities = { //To wrap the activity delegate new InvokeFunc <int, int, long> { Func = Callback, Argument1 = new InArgument <int>(env => XX.Get(env)), //Must wire with local InArgument this way. Argument2 = new InArgument <int>(env => YY.Get(env)), Result = v, //buffer the callback Result in v }, //To wire the callback Result with the local Result. new Assign <long> { To = new ArgumentReference <long> { ArgumentName = "Result" }, Value = v, } }, }; }
static void Main(string[] args) { XX obj = new XX(); obj.MyEvent += new MyDelegate(obj.Display); obj.RaiseEvent(); Console.ReadLine(); }
public void ClassFactory_Resolve_Returns_Singleton_In_Preference_To_New_Instance() { _ClassFactory.Register <IX, X>(); XX singleton = new XX(); _ClassFactory.RegisterInstance <IX>(singleton); Assert.AreSame(singleton, _ClassFactory.Resolve <IX>()); }
static void Main(string[] args) { XX obj = new XX(); obj.MyEvent += new MyDelegate(obj.Add); obj.MyEvent += new MyDelegate(obj.Subtract); obj.RaiseEvent(20, 10); Console.Read(); }
public override string ToString() { string str = "{X:" + X.ToString() + ", Y:" + Y.ToString() + ", Z:" + Z.ToString() + ", XX:" + XX.ToString() + ", YY:" + YY.ToString() + ", ZZ:" + ZZ.ToString() + "}"; return("GSA Spring " + str); }
// Threadsafe public void Basis(XX xx, double[] ans, int np) { Debug.Assert(np == NTERMS); double x = xx.x; double y = xx.y; for (int i = 0; i < NTERMS; i++) { ans[i] = QuickPow(x, xpow[i]) * QuickPow(y, ypow[i]); } }
public override string ToString() { string str = System.Environment.NewLine + "X: " + X.ToString() + ", Y: " + Y.ToString() + ", Z: " + Z.ToString() + ", XX: " + XX.ToString() + ", YY: " + YY.ToString() + ", ZZ: " + ZZ.ToString(); return("GSA Bool 6" + str); }
public override int GetHashCode() { var hashCode = -987908381; hashCode = hashCode * -1521134295 + base.GetHashCode(); hashCode = hashCode * -1521134295 + x.GetHashCode(); hashCode = hashCode * -1521134295 + y.GetHashCode(); hashCode = hashCode * -1521134295 + XX.GetHashCode(); hashCode = hashCode * -1521134295 + YY.GetHashCode(); hashCode = hashCode * -1521134295 + minOfXY.GetHashCode(); hashCode = hashCode * -1521134295 + maxOfXY.GetHashCode(); return(hashCode); }
public override int GetHashCode() { int h = 17; unchecked { h = h * 23 + XX.GetHashCode(); h = h * 23 + XY.GetHashCode(); h = h * 23 + YX.GetHashCode(); h = h * 23 + YY.GetHashCode(); } return(h); }
static public void ShowLambdas() { XX xx = x => x * x; int z = xx(6); Console.WriteLine(z); Mess mess = () => Console.WriteLine("Hello"); Mess mess2 = () => Console.WriteLine("World"); X xd = x => Console.WriteLine(x); mess(); mess2(); xd(6); }
private void getImageSize() { Single X; Single Y; Single XX; Single YY; X = adjustedImage.Width; Y = adjustedImage.Height; XX = (X / DPI) * (Single)2.54; YY = (Y / DPI) * (Single)2.54; txtWidthX.Text = X.ToString(); txtHeightY.Text = Y.ToString(); txtWidth.Text = XX.ToString(); txtHeight.Text = YY.ToString(); }
public override int GetHashCode() { int result = 17; result = 31 * result + XX.GetHashCode(); result = 31 * result + XY.GetHashCode(); result = 31 * result + XZ.GetHashCode(); result = 31 * result + YX.GetHashCode(); result = 31 * result + YY.GetHashCode(); result = 31 * result + YZ.GetHashCode(); result = 31 * result + ZX.GetHashCode(); result = 31 * result + ZY.GetHashCode(); result = 31 * result + ZZ.GetHashCode(); return(result); }
protected void view_product(object sender, EventArgs e) { //Get the information of the connection to the database string connStr = ConfigurationManager.ConnectionStrings["MyDbConn"].ToString(); //create a new connection SqlConnection conn = new SqlConnection(connStr); /*create a new SQL command which takes as parameters the name of the stored procedure and * the SQLconnection name*/ SqlCommand cmd = new SqlCommand("vendorviewProducts", conn); cmd.CommandType = CommandType.StoredProcedure; //To read the input from the user string vendoName = Session["username"].ToString(); //pass parameters to the stored procedure cmd.Parameters.Add(new SqlParameter("@vendorname", vendoName)); //Save the output from the procedure SqlParameter check = cmd.Parameters.Add("@check", SqlDbType.Int); check.Direction = ParameterDirection.Output; conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); //Executing the SQLCommand if (check.Value.ToString().Equals("0")) { Response.Write("you did not post a product yet"); DataTable table = new DataTable(); using (SqlDataAdapter da = new SqlDataAdapter(cmd)) { da.Fill(table); } this.XX.Visible = true; this.XX.DataSource = table; XX.DataBind(); } }
public void ClassFactory_Resolve_Returns_Singleton_In_Preference_To_New_Instance() { _ClassFactory.Register<IX, X>(); XX singleton = new XX(); _ClassFactory.RegisterInstance<IX>(singleton); Assert.AreSame(singleton, _ClassFactory.Resolve<IX>()); }
protected internal void f() { XX.WriteLine("A.f()"); }
public new static void g() { XX.WriteLine("B.g()"); A.x = new X(); }
public static void Main() { XX.debug = false; x = XX.create(); }
public static Poly2D PolyFit2D(Poly2DFactory poly2dfactory, int NX, int NY, double[,] data, XX[,] pos) { int NPT = 0; for (int i = 0; i < data.GetLength(0); i++) { for (int j = 0; j < data.GetLength(1); j++) { if (!Double.IsNaN(data[i, j])) { NPT++; } } } int NTERMS = poly2dfactory.NTERMS; XX[] xx = new XX[NPT]; double[] z = new double[NPT]; // The function value at each point double[] sig = new double[NPT]; // Measurement errors // flatten: data -> z, pos -> xx const float SIGMIN = 0.02f; int rowno = 0; for (int i = 0; i < NX; i++) { for (int j = 0; j < NY; j++) { if (Double.IsNaN(data[i, j])) { continue; } xx[rowno] = pos[i, j]; z[rowno] = data[i, j]; sig[rowno] = Math.Max(z[rowno] * SIGMIN, SIGMIN); // note that 1/sig[i] is used in FindFit rowno++; } } Debug.Assert(rowno == NPT); // do the fit double[] coeff, w; double[,] u, v; double chiSq; FindFit(xx, z, sig, NTERMS, delegate(X _x, double[] _p, int _np) { poly2dfactory.Basis((XX)_x, _p, _np); }, out coeff, out u, out v, out w, out chiSq); Debug.Assert(coeff.Length == NTERMS); Debug.Assert(w.Length == NTERMS); Debug.Assert((u.GetLength(0) == NPT) && (u.GetLength(1) == NTERMS)); Debug.Assert((v.GetLength(0) == NTERMS) && (v.GetLength(1) == NTERMS)); // calculate covariances double[,] covar = null; #if false // not used covar = new double[NTERMS, NTERMS]; ComputeFitCovariance(v, NTERMS, w, covar); #endif return(new Poly2D(poly2dfactory, coeff, covar, chiSq)); }