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


C# Function类代码示例

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


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

示例1: Data

    //Converts the bytes into an object of type Data
    public Data(byte[] data)
    {
        //The first four bytes store the length of the name
        int nameLen = BitConverter.ToInt32(data, 0);

        //This check makes sure that strName has been passed in the array of bytes
        if (nameLen > 0)
            this.strName = Encoding.UTF8.GetString(data, 4, nameLen);
        else
            this.strName = null;

        //The next four store the function
        this.function = (Function)BitConverter.ToInt32(data, 4 + nameLen);

        //The rest store the dynamically stored parameters
        byte[] objectData = new byte[1024];

        //I am making a new array with only the parameters, could probably find a better way
        Array.Copy(data, 8 + nameLen, objectData, 0, 512);

        BinaryFormatter formatter = new BinaryFormatter();
        MemoryStream ms = new MemoryStream(objectData);

        this.objects = (object[])formatter.Deserialize(ms);
    }
开发者ID:sunenilausen,项目名称:SocketsNetwork,代码行数:26,代码来源:Data.cs

示例2: AddSubFunction

 public void AddSubFunction(Function f)
 {
     if (_subFunctions.Contains(f) || f == this)
         return;
     _subFunctions.Add(f);
     OnPropertyChanged("SubFunctions");
 }
开发者ID:danielwerthen,项目名称:Funcis-Sharp,代码行数:7,代码来源:Function.cs

示例3: Insert

 /// <summary>
 ///   Insert a <see cref="Function"/> passed as an argument via Stored Procedure that returns the newly inserted Function Key 
 /// </summary>
 /// <param name="aFunction">A <see cref="Function"/>.</param>
 /// <exception cref="ArgumentNullException">If <c>aFunction</c> argument is <c>null</c>.</exception>
 public static void Insert(Function aFunction)
 {
     if (aFunction == null)
     {
         throw new ArgumentNullException("aFunction");
     }
     using (var vSqlCommand = new SqlCommand()
     {
         CommandType = CommandType.Text,
         Connection = new SqlConnection(Connection.Instance.SqlConnectionString)
     })
     {
         var vStringBuilder = new StringBuilder();
         vStringBuilder.AppendLine("insert into FNC_Function");
         vStringBuilder.AppendLine("       (FNC_Code, FNC_Name)");
         vStringBuilder.AppendLine("values");
         vStringBuilder.AppendLine("       (@FNCCode, @FNCName)");
         vStringBuilder.AppendLine(";");
         vStringBuilder.AppendLine("select SCOPE_IDENTITY()");
         ObjectToData(vSqlCommand, aFunction);
         vSqlCommand.CommandText = vStringBuilder.ToString();
         vSqlCommand.Connection.Open();
         aFunction.FncKey = Convert.ToInt32(vSqlCommand.ExecuteScalar());
         vSqlCommand.Connection.Close();
     }
 }
开发者ID:heinschulie,项目名称:zfit,代码行数:31,代码来源:FunctionData.cs

示例4: GetFunctions

        public static IQueryable<Function> GetFunctions(List<string> functionMethodList)
        {
            var data = dataAccess();
            var autoAdded = false;
            //var functionMethodList = FSM.Functions.FSMFunctionLoader.GetFunctionList();
            var functions = data.GetFunctions();
            var functionList = functions.ToDictionary(f => f.FunctionName, f => f);

            foreach (var functionName in functionMethodList)
            {
                if(!functionList.ContainsKey(functionName))
                {
                    autoAdded = true;
                    var newFunction = new Function();
                    newFunction.FunctionName = functionName;
                    newFunction.Description = functionName + " @Added Automatically";
                    newFunction.FunctionURI = "";
                    CreateFunction(newFunction);
                }
            }

            functions = autoAdded ? data.GetFunctions() : functions;

            return functions;
        }
开发者ID:AbbottF,项目名称:FSM.Manager,代码行数:25,代码来源:DataHelper.cs

示例5: VisitFunctionDecl

        public override bool VisitFunctionDecl(Function function)
        {
            if (!VisitDeclaration(function))
                return false;

            var ret = function.ReturnType;

            string msg;
            if (HasInvalidType(ret.Type, out msg))
            {
                function.ExplicitlyIgnore();
                Log.Debug("Function '{0}' was ignored due to {1} return decl",
                    function.Name, msg);
                return false;
            }

            foreach (var param in function.Parameters)
            {
                if (HasInvalidDecl(param, out msg))
                {
                    function.ExplicitlyIgnore();
                    Log.Debug("Function '{0}' was ignored due to {1} param",
                        function.Name, msg);
                    return false;
                }

                if (HasInvalidType(param.Type, out msg))
                {
                    function.ExplicitlyIgnore();
                    Log.Debug("Function '{0}' was ignored due to {1} param",
                        function.Name, msg);
                    return false;
                }

                var decayedType = param.Type.Desugar() as DecayedType;
                if (decayedType != null)
                {
                    function.ExplicitlyIgnore();
                    Log.Debug("Function '{0}' was ignored due to unsupported decayed type param",
                        function.Name);
                    return false;
                }

                if (param.Kind == ParameterKind.IndirectReturnType)
                {
                    Class retClass;
                    param.Type.Desugar().TryGetClass(out retClass);
                    if (retClass == null)
                    {
                        function.ExplicitlyIgnore();
                        Log.Debug(
                            "Function '{0}' was ignored due to an indirect return param not of a tag type",
                            function.Name);
                        return false;
                    }
                }
            }

            return true;
        }
开发者ID:daxiazh,项目名称:CppSharp,代码行数:60,代码来源:CheckIgnoredDecls.cs

示例6: Integrate

 public double Integrate(Function f, int numberOfNodes)
 {
     this.initializeListOfQuadratures(numberOfNodes);
     double result = this.Integrator(f);
     this.quadratures.Clear();
     return result;
 }
开发者ID:Elejdor,项目名称:mn_2014,代码行数:7,代码来源:LaguerreIntegrator.cs

示例7: GetTopFunctionList

    public string GetTopFunctionList()
    {
        string sql = "SELECT * FROM dbo.FunctionList WHERE parentId IS NULL ORDER BY orderFlag";
        IList<Function> TopFunctionList = new List<Function>();
        using (DataTable table = SqlHelper.ExecuteDataset(CommonInfo.ConQJVRMS, CommandType.Text, sql).Tables[0])
        {
            foreach (DataRow row in table.Rows)
            {
                Function f = new Function();
                f.Description = row["Description"].ToString();
                f.FunctionName = row["FunctionName"].ToString();
                f.UrlPath = row["UrlPath"].ToString();
                f.FunctionID = new Guid(row["FunctionId"].ToString());
                f.OrderFlag = int.Parse(row["orderFlag"].ToString());

                if (row["parentid"] == DBNull.Value)
                {
                    f.ParentFunctionId = null;
                }
                else
                {
                    f.ParentFunctionId = new Guid(row["parentId"].ToString());
                }
                
                TopFunctionList.Add(f);
            }
        }
        SerializeObjectFactory sof = new SerializeObjectFactory();
        return sof.SerializeToBase64(TopFunctionList);
    }
开发者ID:rongcheng,项目名称:benz,代码行数:30,代码来源:FunctionService.cs

示例8: Parse

        public void Parse(string stmt)
        {
            if (string.IsNullOrEmpty(stmt)) throw new Exception("Syntax Error: nil statement");
            stmt = stmt.Trim();
            if (string.IsNullOrEmpty(stmt)) throw new Exception("Syntax Error: nil statement");

            if (!Regex.IsMatch(stmt, @"^(\w{1}|\w+(.*)(\w+|\)))$")) {
                throw new Exception("Syntax Error: Invalid statement.");
            }

            List<Identifier> idlist = new List<Identifier>();
            var funcs = Regex.Matches(stmt, @"\b[a-zA-Z]\w*\((\s*\w+(\s*\,\s*\w+)*)\s*\)");
            int lastFuncEnd = 0;

            foreach (Match m in funcs) {
                Function func = new Function(m.Groups[0].Value, m.Groups[1].Value);
                //parse any identifiers before the function
                ParseIdentifiers(idlist, stmt, lastFuncEnd, m.Index);
                lastFuncEnd = m.Index + m.Length;
                idlist.Add(func);
            }

            //parse the identifiers after the last function
            ParseIdentifiers(idlist, stmt, lastFuncEnd, stmt.Length);
            _identifiers = idlist.ToArray();
        }
开发者ID:sekcheong,项目名称:graphdemo,代码行数:26,代码来源:Statement.cs

示例9: VisitFunctionDecl

        public override bool VisitFunctionDecl(Function function)
        {
            if (!VisitDeclaration(function))
                return false;

            if (function.IsReturnIndirect)
            {
                var indirectParam = new Parameter()
                    {
                        Kind = ParameterKind.IndirectReturnType,
                        QualifiedType = function.ReturnType,
                        Name = "return",
                    };

                function.Parameters.Insert(0, indirectParam);
                function.ReturnType = new QualifiedType(new BuiltinType(
                    PrimitiveType.Void));
            }

            if (function.HasThisReturn)
            {
                // This flag should only be true on methods.
                var method = (Method) function;
                var classType = new QualifiedType(new TagType(method.Namespace),
                    new TypeQualifiers {IsConst = true});
                function.ReturnType = new QualifiedType(new PointerType(classType));
            }

            // TODO: Handle indirect parameters

            return true;
        }
开发者ID:corefan,项目名称:CppSharp,代码行数:32,代码来源:CheckAbiParameters.cs

示例10: CreateProcess

 public ProcessDescriptor CreateProcess(Process.EProcessKind kind, Function func, params ISignalOrPortDescriptor[] sensitivity)
 {
     func.Name = _dpb._psName + "_FuPs" + _dpb._nextFUProcessIndex + "_" + func.Name;
     var result = _orgBinder.CreateProcess(kind, func, sensitivity);
     ++_dpb._nextFUProcessIndex;
     return result;
 }
开发者ID:venusdharan,项目名称:systemsharp,代码行数:7,代码来源:DefaultDatapathBuilder.cs

示例11: Process

        public Documentation Process(Function f, EnumProcessor processor)
        {
            Documentation docs = null;

            if (DocumentationCache.ContainsKey(f.WrappedDelegate.Name))
            {
                return DocumentationCache[f.WrappedDelegate.Name];
            }
            else
            {
                var file = Settings.FunctionPrefix + f.WrappedDelegate.Name + ".xml";
                if (!DocumentationFiles.ContainsKey(file))
                    file = Settings.FunctionPrefix + f.TrimmedName + ".xml";
                if (!DocumentationFiles.ContainsKey(file))
                    file = Settings.FunctionPrefix + f.TrimmedName.TrimEnd(numbers) + ".xml";

                docs = 
                    (DocumentationFiles.ContainsKey(file) ? ProcessFile(DocumentationFiles[file], processor) : null) ??
                    new Documentation
                    {
                        Summary = String.Empty,
                        Parameters = f.Parameters.Select(p =>
                        new DocumentationParameter(p.Name, String.Empty)).ToList()
                    };

                DocumentationCache.Add(f.WrappedDelegate.Name, docs);
            }

            return docs;
        }
开发者ID:RegApp4Me,项目名称:opentk,代码行数:30,代码来源:DocProcessor.cs

示例12: Prepare

        public void Prepare(Function fn, ClassRemotes.Remote remote)
        {
            remoteDisplay.Clear();
            remoteDisplay.AnyTextChanged += SomeTextChanged;

            // Do things differently basen on whether we are using this
            // form to add a new remote repo, rename it or we are editing
            // an existing remote repo

            switch (fn)
            {
                case Function.Add:
                    remoteDisplay.Enable(true, true);
                    remote.Name = "origin";
                    remote.PushCmd = "";
                    remoteDisplay.Set(remote);
                    Text = "Add a new remote repository";
                    btOK.Enabled = false;
                    break;
                case Function.Edit:
                    Text = "Edit remote repository '" + remote.Name + "'";
                    remoteDisplay.Enable(false, true);
                    remoteDisplay.Set(remote);
                    break;
                case Function.Rename:
                    Text = "Rename remote repository '" + remote.Name + "'";
                    remoteDisplay.Enable(true, false);
                    remoteDisplay.Set(remote);
                    break;
            }
        }
开发者ID:splintor,项目名称:GitForce,代码行数:31,代码来源:FormRemoteAddEdit.cs

示例13: CachedFunction

		CachedFunction(Function f, Cache c)
		{
			this.f = f;
			this.cache = c;

			this.unique_id = count; ++count;
		}
开发者ID:ufcpp,项目名称:UfcppSample,代码行数:7,代码来源:CachedFunction.cs

示例14: PopulateFunctionInfoFromDeclaration

 private void PopulateFunctionInfoFromDeclaration(Function aFunction)
 {
     var functionSections = Regex.Match(aFunction.Declaration, @"(\w+)( \w+)? (\w+)\((.+?)\)");
     ReturnType = functionSections.Groups[1].Value;
     Parameters = functionSections.Groups[4].Value;
     FunctionName = functionSections.Groups[3].Value;
 }
开发者ID:subTee,项目名称:Deviare2,代码行数:7,代码来源:FunctionNode.cs

示例15: GetArgumentDependentVariables

        public void GetArgumentDependentVariables()
        {
            IFunction f = new Function();
            IVariable c1 = new Variable<int>("c1");
            IVariable c2 = new Variable<int>("c2");
            IVariable x = new Variable<int>("x");
            
            f.Components.Add(c1);
            f.Components.Add(c2);

            IDictionary<IVariable, IEnumerable<IVariable>> dependentVariables = MemoryFunctionStoreHelper.GetDependentVariables(f.Store.Functions);
            
            //no argument dependencies yet
            Assert.AreEqual(2, dependentVariables.Count);
            Assert.AreEqual(new IVariable[0],dependentVariables[c1].ToArray());
            Assert.AreEqual(new IVariable[0], dependentVariables[c2].ToArray());
            
            f.Arguments.Add(x);
            
            dependentVariables = MemoryFunctionStoreHelper.GetDependentVariables(f.Store.Functions);

            Assert.AreEqual(3, dependentVariables.Count);
            Assert.AreEqual(2, dependentVariables[x].Count());
            Assert.AreEqual(new[]{c1,c2},dependentVariables[x]);
            //Assert.IsTrue(dependentVariables[x].Contains(c1));
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:26,代码来源:MemoryFunctionStoreHelperTest.cs


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