当前位置: 首页>>代码示例>>C#>>正文


C# Param类代码示例

本文整理汇总了C#中Param的典型用法代码示例。如果您正苦于以下问题:C# Param类的具体用法?C# Param怎么用?C# Param使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Param类属于命名空间,在下文中一共展示了Param类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Expected

        public Info[] Expected(Specification problem)
        {
            Function function = problem.Function.Invoke;
            Gradient gradient = problem.Gradient.Invoke;

            Param param = new Param()
            {
                m = m,
                epsilon = epsilon,
                past = past,
                delta = delta,
                max_iterations = max_iterations,
                linesearch = (int)linesearch,
                max_linesearch = max_linesearch,
                min_step = min_step,
                max_step = max_step,
                ftol = ftol,
                wolfe = wolfe,
                gtol = gtol,
                xtol = xtol,
                orthantwise_c = orthantwise_c,
                orthantwise_start = orthantwise_start,
                orthantwise_end = orthantwise_end
            };

            NativeCode = Wrapper.Libbfgs((double[])problem.Start.Clone(), function, gradient, param);

            // Convergence and success have the same
            // enumeration value in the original code
            if (NativeCode == "LBFGS_CONVERGENCE")
                NativeCode = "LBFGS_SUCCESS";

            return Wrapper.list.ToArray();
        }
开发者ID:RLaumeyer,项目名称:framework,代码行数:34,代码来源:LBFGSComparer.cs

示例2: Clone

        public virtual object Clone()
        {
            Param param = new Param();
            
            param.m_identifier = m_identifier;
            param.m_name = m_name;
            param.m_type = m_type;
            param.m_lazy = m_lazy;

            if(m_value != null)
            {
                if(m_value is IUimlElement)
                {
                    param.m_value = ((IUimlElement)m_value).Clone();
                }
                else
                {
                    param.m_value = m_value;
                }
            }
            if(m_subprop != null)
            {
                param.m_subprop = m_subprop;
            }

            param.PartTree = m_partTree;

            return param;

        }        
开发者ID:jozilla,项目名称:Uiml.net,代码行数:30,代码来源:Param.cs

示例3: AddElementToDataGridView

		private void AddElementToDataGridView(Param element)
		{
			var row = new DataGridViewRow();
			
			// пустая сточка означет разделитель между 
			// отдельными интерфейсами
			if(element.ParamName == string.Empty)
			{
				dataGridView1.Rows.Add(row);
				return;	
			}
			
			// добавляем первую ячейку
			var cell1 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamName + ":"
			};
			cell1.Style.Font = new Font(dataGridView1.Font, FontStyle.Bold);
			row.Cells.Add(cell1);
			
			// добавляем вторую ячейку
			var cell2 = new DataGridViewTextBoxCell() 
			{
			    Value = element.ParamValue
			};
			row.Cells.Add(cell2);

			// добавляем строчку в dataGridView
			dataGridView1.Rows.Add(row);
		}
开发者ID:nemocaptm,项目名称:Mashine-side,代码行数:30,代码来源:CPU.cs

示例4: CreateSuggorateModel

        public void CreateSuggorateModel()
        {
            // configure model (do once at app startup)
            var model = RuntimeTypeModel.Default;
            model.Add(typeof(Param), false).SetSurrogate(typeof(ParamSurrogate));
            model.Add(typeof (FloatData), false).Add("Ranges", "AdjustValue", "Values");
            //TODO: other types here

            // test data
            var param = new Param
            {
                Item = new FloatData
                {
                    AdjustValue = 123.45F,
                    Ranges = new float[] { 1.0F, 2.4F },
                    Values = new float[] { 7.21F, 19.2F }
                }
            };
            // note the fallowing is the same as Serializer.DeepClone, since
            // model === RuntimeTypeModel.Default
            var clone = (Param) model.DeepClone(param);
            Assert.AreNotSame(clone, param, "Different instance");
            Assert.IsInstanceOfType(typeof(FloatData), clone.Item, "Data type");
            var data = (FloatData) clone.Item;
            Assert.AreEqual(123.45F, data.AdjustValue);
            Assert.AreEqual(2, data.Ranges.Length);
            Assert.AreEqual(1.0F, data.Ranges[0]);
            Assert.AreEqual(2.4F, data.Ranges[1]);
            Assert.AreEqual(2, data.Values.Length);
            Assert.AreEqual(7.21F, data.Values[0]);
            Assert.AreEqual(19.2F, data.Values[1]);

        }
开发者ID:GeorchW,项目名称:protobuf-net,代码行数:33,代码来源:SurrogateForObjectUsage.cs

示例5: FieldToCollection

        public static ObservableCollection<Param> FieldToCollection(string strXml)
        {
            string XmlTemplete = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "\r\n" +
                            "<Paras>" + "\r\n" +
                            "{0}" +
                                     "</Paras>";
            XmlTemplete = string.Format(XmlTemplete, strXml);
            Byte[] b = System.Text.UTF8Encoding.UTF8.GetBytes(XmlTemplete);
            XElement xele = XElement.Load(System.Xml.XmlReader.Create(new MemoryStream(b)));

            var Param = from item in xele.Descendants("Para")
                        select item;
            ObservableCollection<Param> List = new ObservableCollection<Param>();
            foreach (var vv in Param)
            {
                Param r = new Param();
                r.FieldID = vv.Attribute("Value").Value.CvtString().Replace("{", "").Replace("}", "");
                try
                {
                    r.FieldName = vv.Attribute("ValueName").Value.CvtString();
                }
                catch
                {
                    r.FieldName = string.Empty;
                }
                r.Description = vv.Attribute("Description").Value.CvtString();
                r.TableName = vv.Attribute("TableName").Value.CvtString();
                r.ParamID = vv.Attribute("Name").Value.CvtString();
                r.ParamName = vv.Attribute("Description").Value.CvtString();
                List.Add(r);
            }
            return List;
        }
开发者ID:JuRogn,项目名称:OA,代码行数:33,代码来源:ParamOperate.cs

示例6: GetContiguousAcres

        /// <summary>
        /// Returns the contiguous acres associated with the user. This method does NOT
        /// populate the contiguous acres' wells property.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public List<ContiguousAcres> GetContiguousAcres(int userId, bool includeNonOwned)
        {
            Param[] nonOwnedCAParams = new Param[] {};
            string[] nonOwnedCAParamNames = null;
            if (includeNonOwned) {
                var caIds = new PropertyDalc().GetAssociatedCAIds(userId);
                if (caIds.Count() == 0) {
                    // No associations exist; don't even try to retrieve them.
                    includeNonOwned = false;
                } else {
                    nonOwnedCAParams = ParameterizeInClause("caId", out nonOwnedCAParamNames, caIds.ToArray());
                }
            }

            return ExecuteDataTable(@"
            select
            ca.OBJECTID,
            ca.caID,
            ca.area as area_m2,
            ca.admin_area as area_acres,
            ca.description,
            ca.approved,
            ca.actingId
            from HP_CONTIGUOUS_ACRES" + dbTableSuffix + @" ca
            where
            (ca.actingId = @id" + (includeNonOwned
                        ? " or ca.caId in (" + string.Join(", ", nonOwnedCAParamNames) + "))"
                        : ")") + @"
            and isnull(ca.Deletion, '') <> 'True';",
                        new Param[] { new Param("@id", userId) }.Concat(nonOwnedCAParams).ToArray()
                ).AsEnumerable().Select(row => GetCAFromDataRow(row)).ToList();
        }
开发者ID:jiadreamran,项目名称:HPAuthenticate,代码行数:38,代码来源:GisDalc.cs

示例7: Parse

 /// <summary>
 /// This static method parses the command line, storing the parameter values, and
 /// returning the index of the first non-option command line argument.
 /// </summary>
 /// <param name="args"></param>
 /// <param name="rgParam"></param>
 /// <param name="index"></param>
 /// <returns></returns>
 public static bool Parse(string[] args, ref Param[] rgParam, out int index)
 {
     index = args.Length;
     try
     {
         for (int i = 0; i < args.Length; ++i)
         {
             if (args[i].StartsWith("-"))
             {
                 bool fOk;
                 if (args[i].StartsWith("--"))
                     fOk = CheckLongParamNames(args, rgParam, ref i);
                 else
                     fOk = CheckShortParamNames(args, rgParam, ref i);
                 if (!fOk)
                     throw new Exception(String.Format("Invalid option found in {0}", args[i]));
             }
             else
             {
                 index = i;
                 return true;
             }
         }
         index = args.Length;
         return true;
     }
     catch (Exception ex)
     {
         s_sError = ex.Message;
         return false;
     }
 }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:40,代码来源:GetOptions.cs

示例8: Usage

 /// <summary>
 ///
 /// </summary>
 /// <param name="rgParam"></param>
 public static void Usage(Param[] rgParam)
 {
     int cLen = 0;
     for (int i = 0; i < rgParam.Length; ++i)
     {
         if (!String.IsNullOrEmpty(rgParam[i].LongName))
         {
             int cch = rgParam[i].LongName.Length;
             if (cLen < cch)
                 cLen = cch;
         }
     }
     cLen += 4;
     for (int i = 0; i < rgParam.Length; ++i)
     {
         string sShort;
         if (String.IsNullOrEmpty(rgParam[i].ShortName))
             sShort = "  ";
         else
             sShort = String.Format("-{0}", rgParam[i].ShortName);
         string sLong;
         if (String.IsNullOrEmpty(rgParam[i].LongName))
             sLong = "    ";
         else
             sLong = String.Format("(--{0})", rgParam[i].LongName);
         while (sLong.Length < cLen)
             sLong = sLong + " ";
         string sLine = String.Format("  {0} {1} = {2}",
             sShort, sLong, rgParam[i].Description);
         Console.WriteLine(sLine);
     }
 }
开发者ID:sillsdev,项目名称:FwSupportTools,代码行数:36,代码来源:GetOptions.cs

示例9: AddParameter

 internal void AddParameter(string name, string sval)
 {
     Param p = new Param();
     p.ParamName = name;
     p.ParamValue = sval;
     Parameters.Add(p);
 }
开发者ID:CBenghi,项目名称:UnnItBooster,代码行数:7,代码来源:ReportServer.cs

示例10: Tv

 public Tv(string nameTv, bool stateTv, Channels channelCur, byte volumeCur, byte brightCur)
     : base(nameTv, stateTv)
 {
     channel = channelCur;
     volume = new Param(volumeCur, 1, 5);
     bright = new Param(brightCur, 1, 5);
 }
开发者ID:agorishniy,项目名称:SmartHouseWebForm,代码行数:7,代码来源:Tv.cs

示例11: Expected

        public Info[] Expected(Specification problem)
        {
            Function function = problem.Function.Invoke;
            Gradient gradient = problem.Gradient.Invoke;

            Param param = new Param()
            {
                m = m,
                epsilon = epsilon,
                past = past,
                delta = delta,
                max_iterations = max_iterations,
                linesearch = (int)linesearch,
                max_linesearch = max_linesearch,
                min_step = min_step,
                max_step = max_step,
                ftol = ftol,
                wolfe = wolfe,
                gtol = gtol,
                xtol = xtol,
                orthantwise_c = orthantwise_c,
                orthantwise_start = orthantwise_start,
                orthantwise_end = orthantwise_end
            };

            NativeCode = Wrapper.Libbfgs((double[])problem.Start.Clone(), function, gradient, param);

            return Wrapper.list.ToArray();
        }
开发者ID:KommuSoft,项目名称:accord_framework,代码行数:29,代码来源:LBFGSComparer.cs

示例12: GetParamByID

        public static ParamInfo GetParamByID(int paramid)
        {
            Param pra = new Param();

            if (!enableCaching)
                return pra.GetParamByID(paramid);

            string key = "param_" + paramid;

            ParamInfo data = (ParamInfo)HttpRuntime.Cache[key];

            // Check if the data exists in the data cache
            if (data == null)
            {
                // If the data is not in the cache then fetch the data from the business logic tier
                data = pra.GetParamByID(paramid);

                // Create a AggregateCacheDependency object from the factory
                AggregateCacheDependency cd = DependencyFacade.GetDeviceDependency();

                // Store the output in the data cache, and Add the necessary AggregateCacheDependency object
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(ParamTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return data;

        }
开发者ID:liyangshiren,项目名称:FWMoniter,代码行数:27,代码来源:ParamDataProxy.cs

示例13: GenerateMethod

        private static void GenerateMethod()
        {
            Method method = new Method();
            method.Name = "MyNewProc";
            method.MethodType = MethodTypeEnum.Void;
            Param newParam = new Param();
            TypeReferenceExpression newTypeReferenceExpression = new TypeReferenceExpression();
            newTypeReferenceExpression.Name = CodeRush.Language.GetSimpleTypeName("System.Int32");
            newParam.MemberTypeReference = newTypeReferenceExpression;
            newParam.Name = "MyKillerParameter";

            method.Parameters.Add(newParam);

            MethodCall statement = new MethodCall();
            statement.Name = "Start";
            //UnaryIncrement newUnaryIncrement = new UnaryIncrement();
            //ElementReferenceExpression elementReferenceExpression = new ElementReferenceExpression(newParam.Name);
            //newUnaryIncrement.Expression = elementReferenceExpression;
            //statement.AddDetailNode(newUnaryIncrement);
            //int MyKillerParameter = 0;
            //MyKillerParameter++;

            method.AddNode(statement);
            string newCode = CodeRush.Language.GenerateElement(method);
            TextDocument activeTextDocument = CodeRush.Documents.ActiveTextDocument;
            if (activeTextDocument == null)
                return;

            activeTextDocument.InsertText(activeTextDocument.ActiveView.Caret.SourcePoint, newCode);
        }
开发者ID:modulexcite,项目名称:CR_OptionsInverter,代码行数:30,代码来源:PlugIn1.cs

示例14: MyMethod

		public void MyMethod(Param stateIdentifier)
		{
			GetSate(stateIdentifier);
			counter++;
			var sessionId = OperationContext.Current.SessionId;
			Trace.WriteLine(string.Format("Counter = {0}, SessionId = {1}", counter, sessionId));
			SaveState(stateIdentifier);
		}
开发者ID:Helen1987,项目名称:edu,代码行数:8,代码来源:MyService.svc.cs

示例15: AddParam

        private static void AddParam(Param p)
        {
            if (_params.Count > 0)
                _allParams.Append(", ");
            _allParams.Append(p.Name);

            _params.Add(p.Name.ToLower(), p);
        }
开发者ID:Bedrok,项目名称:800craft,代码行数:8,代码来源:LifeHandler.cs


注:本文中的Param类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。