示例#1
0
        private string CSharpTextProperty(ICSharpUsingCollection usingCollection, ICSharpPropertyFeature feature)
        {
            string Result;

            string BaseTypeText;

            if (BaseType != null)
            {
                BaseTypeText = EffectiveBaseType.Type2CSharpString(usingCollection, CSharpTypeFormats.AsInterface, CSharpNamespaceFormats.OneWord);
            }
            else
            {
                BaseTypeText = $"I{CSharpNames.ToCSharpIdentifier(Delegated.Owner.ValidClassName)}";
            }

            Result = $"({BaseTypeText} agentBase) => {{ return agentBase.{CSharpNames.ToCSharpIdentifier(Delegated.Name)}; }}";

            return(Result);
        }
示例#2
0
        private string CSharpTextFunction(ICSharpUsingCollection usingCollection, ICSharpFunctionFeature feature)
        {
            string Result;

            // TODO handle several overloads.

            Debug.Assert(feature.OverloadList.Count > 0);
            ICSharpQueryOverload Overload = feature.OverloadList[0] as ICSharpQueryOverload;

            Debug.Assert(Overload != null);

            string BaseTypeText;

            if (BaseType != null)
            {
                BaseTypeText = EffectiveBaseType.Type2CSharpString(usingCollection, CSharpTypeFormats.AsInterface, CSharpNamespaceFormats.OneWord);
            }
            else
            {
                BaseTypeText = $"I{CSharpNames.ToCSharpIdentifier(Delegated.Owner.ValidClassName)}";
            }

            string AgentParameters;
            string ParameterNameListText;

            if (Overload.ParameterList.Count > 0)
            {
                CSharpArgument.BuildParameterList(usingCollection, Overload.ParameterList, out string ParameterListText, out ParameterNameListText);
                AgentParameters = $"({BaseTypeText} agentBase, {ParameterListText})";
            }
            else
            {
                AgentParameters       = $"({BaseTypeText} agentBase)";
                ParameterNameListText = string.Empty;
            }

            Result = $"{AgentParameters} => {{ return agentBase.{CSharpNames.ToCSharpIdentifier(Delegated.Name)}({ParameterNameListText}); }}";

            return(Result);
        }