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


C# IProcessingContext.AddReference方法代码示例

本文整理汇总了C#中IProcessingContext.AddReference方法的典型用法代码示例。如果您正苦于以下问题:C# IProcessingContext.AddReference方法的具体用法?C# IProcessingContext.AddReference怎么用?C# IProcessingContext.AddReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IProcessingContext的用法示例。


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

示例1: GenerateImplementsElement

        private void GenerateImplementsElement(IProcessingContext context, MemberInfo mInfo)
        {
            Type declaringType = mInfo.DeclaringType;

            if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
                declaringType = declaringType.GetGenericTypeDefinition();

            if (!declaringType.IsInterface)
            {
                Type[] interfaces = declaringType.GetInterfaces();
                foreach (Type ifType in interfaces)
                {
                    if (context.IsFiltered(AssetIdentifier.FromMemberInfo(ifType)))
                        continue;

                    InterfaceMapping ifMap = declaringType.GetInterfaceMap(ifType);
                    if (ifMap.TargetType != declaringType)
                        continue;

                    var targetMethod =
                        ifMap.TargetMethods.SingleOrDefault(mi => mi.MetadataToken == mInfo.MetadataToken &&
                                                                  mi.Module == mInfo.Module);

                    if (targetMethod != null)
                    {
                        int mIx = Array.IndexOf(ifMap.TargetMethods, targetMethod);

                        AssetIdentifier miAid;
                        if (ifMap.InterfaceMethods[mIx].DeclaringType.IsGenericType)
                        {
                            Type declType = ifMap.InterfaceMethods[mIx].DeclaringType.GetGenericTypeDefinition();
                            MethodInfo[] allMethods =
                                declType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance |
                                                    BindingFlags.Static);

                            miAid =
                                AssetIdentifier.FromMemberInfo(allMethods.Single(mi =>
                                                                                 mi.MetadataToken == ifMap.InterfaceMethods[mIx].MetadataToken &&
                                                                                 mi.Module == ifMap.InterfaceMethods[mIx].Module));
                        }
                        else
                        {
                            miAid = AssetIdentifier.FromMemberInfo(ifMap.InterfaceMethods[mIx]);
                        }

                        context.Element.Add(new XElement("implements", new XAttribute("member", miAid)));
                        context.AddReference(miAid);
                    }
                }
            }
        }
开发者ID:LBi-Dick,项目名称:LBi.LostDoc,代码行数:51,代码来源:DocGenerator.cs

示例2: GenerateTypeElement

        private XElement GenerateTypeElement(IProcessingContext context, AssetIdentifier assetId)
        {
            XElement ret;
            Type type = (Type)context.AssetResolver.Resolve(assetId);


            string elemName;

            if (type.IsClass)
                elemName = "class";
            else if (type.IsEnum)
                elemName = "enum";
            else if (type.IsValueType)
                elemName = "struct";
            else if (type.IsInterface)
                elemName = "interface";
            else
                throw new ArgumentException("Unknown asset type: " + assetId.Type.ToString(), "assetId");

            ret = new XElement(elemName,
                               new XAttribute("name", type.Name),
                               new XAttribute("assetId", assetId),
                               new XAttribute("phase", context.Phase));

            if (type.IsEnum)
            {
                AssetIdentifier aid = AssetIdentifier.FromType(type.GetEnumUnderlyingType());
                ret.Add(new XAttribute("underlyingType", aid));
                context.AddReference(aid);
            }


            if (!type.IsInterface && type.IsAbstract)
                ret.Add(new XAttribute("isAbstract", XmlConvert.ToString(type.IsAbstract)));

            if (!type.IsVisible || type.IsNested && type.IsNestedAssembly)
                ret.Add(new XAttribute("isInternal", XmlConvert.ToString(true)));

            if (type.IsPublic || type.IsNested && type.IsNestedPublic)
                ret.Add(new XAttribute("isPublic", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedPrivate)
                ret.Add(new XAttribute("isPrivate", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamily)
                ret.Add(new XAttribute("isProtected", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamANDAssem)
                ret.Add(new XAttribute("isProtectedAndInternal", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamORAssem)
                ret.Add(new XAttribute("isProtectedOrInternal", XmlConvert.ToString(true)));

            if (type.IsClass && type.IsSealed)
                ret.Add(new XAttribute("isSealed", XmlConvert.ToString(true)));

            if (type.BaseType != null)
            {
                AssetIdentifier baseAid = AssetIdentifier.FromType(type.BaseType);
                if (!context.IsFiltered(baseAid))
                {
                    var inheritsElem = new XElement("inherits");
                    ret.Add(inheritsElem);
                    GenerateTypeRef(context.Clone(inheritsElem), type.BaseType);
                }
            }

            if (type.ContainsGenericParameters)
            {
                Type[] typeParams = type.GetGenericArguments();
                foreach (Type tp in typeParams)
                {
                    this.GenerateTypeParamElement(context.Clone(ret), type, tp);
                }
            }

            if (type.IsClass)
            {
                foreach (Type interfaceType in type.GetInterfaces())
                {
                    InterfaceMapping mapping = type.GetInterfaceMap(interfaceType);
                    if (mapping.TargetType == type)
                    {
                        AssetIdentifier interfaceAssetId =
                            AssetIdentifier.FromType(interfaceType.IsGenericType
                                                         ? interfaceType.GetGenericTypeDefinition()
                                                         : interfaceType);
                        if (!context.IsFiltered(interfaceAssetId))
                        {
                            var implElement = new XElement("implements");
                            ret.Add(implElement);
                            GenerateTypeRef(context.Clone(implElement), interfaceType, "interface");
                        }
                    }
                }
            }


            foreach (IEnricher enricher in this._enrichers)
                enricher.EnrichType(context.Clone(ret), type);
//.........这里部分代码省略.........
开发者ID:LBi-Dick,项目名称:LBi.LostDoc,代码行数:101,代码来源:DocGenerator.cs

示例3: GenerateMethodElement

        private XElement GenerateMethodElement(IProcessingContext context, AssetIdentifier assetId)
        {
            // Debug.Assert(context.Element.Name.LocalName != "type", "Cannot put Method into closed generic type");
            MethodBase mBase = (MethodBase)context.AssetResolver.Resolve(assetId);

            if (mBase is ConstructorInfo)
                return this.GenerateConstructorElement(context, assetId);

            MethodInfo mInfo = (MethodInfo)mBase;

            string elemName;

            if (this.IsOperator(mInfo))
                elemName = "operator";
            else
                elemName = "method";


            XElement ret = new XElement(elemName,
                                        new XAttribute("name", mInfo.Name),
                                        new XAttribute("assetId", assetId),
                                        new XAttribute("phase", context.Phase));

            context.Element.Add(ret);
            Type declaringType = mInfo.DeclaringType;

            if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition)
                declaringType = declaringType.GetGenericTypeDefinition();

            MethodInfo realMethodInfo =
                declaringType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance |
                                         BindingFlags.Static).Single(
                                                                     mi =>
                                                                     mi.MetadataToken == mInfo.MetadataToken &&
                                                                     mi.Module == mInfo.Module);

            AssetIdentifier declaredAs = AssetIdentifier.FromMemberInfo(realMethodInfo);

            if (declaringType != mInfo.ReflectedType)
            {
                ret.Add(new XAttribute("declaredAs", declaredAs));
                context.AddReference(declaredAs);
            }
            else if (realMethodInfo.GetBaseDefinition() != realMethodInfo)
            {
                MethodInfo baseMethod = realMethodInfo.GetBaseDefinition();
                if (baseMethod.ReflectedType.IsGenericType)
                {
                    Type realTypeBase = baseMethod.ReflectedType.GetGenericTypeDefinition();
                    MethodInfo[] allMethods =
                        realTypeBase.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance |
                                                BindingFlags.Static);
                    baseMethod =
                        allMethods.Single(
                                          m =>
                                          m.Module == baseMethod.Module && m.MetadataToken == baseMethod.MetadataToken);
                }

                declaredAs = AssetIdentifier.FromMemberInfo(baseMethod);
                ret.Add(new XAttribute("overrides", declaredAs));
                context.AddReference(declaredAs);
            }

            this.GenerateImplementsElement(context.Clone(ret), mInfo);

            this.GenerateAccessModifiers(ret, mInfo);


            if (mInfo.ContainsGenericParameters)
            {
                Type[] typeParams = mInfo.GetGenericArguments();
                foreach (Type tp in typeParams)
                    this.GenerateTypeParamElement(context.Clone(ret), mInfo, tp);
            }

            foreach (IEnricher item in this.Enrichers)
                item.EnrichMethod(context.Clone(ret), mInfo);

            ParameterInfo[] methodParams = mInfo.GetParameters();
            this.GenerateParameterElements(context.Clone(ret), methodParams);

            if (mInfo.ReturnType != typeof(void))
            {
                XElement retElem = new XElement("returns");

                GenerateTypeRef(context.Clone(retElem), mInfo.ReturnType);

                foreach (IEnricher item in this.Enrichers)
                    item.EnrichReturnValue(context.Clone(retElem), mInfo);

                ret.Add(retElem);
            }


            return ret;
        }
开发者ID:LBi-Dick,项目名称:LBi.LostDoc,代码行数:96,代码来源:DocGenerator.cs

示例4: GenerateAttributeElements

        private static void GenerateAttributeElements(IProcessingContext context,
                                                      IEnumerable<CustomAttributeData> attrData)
        {
            foreach (CustomAttributeData custAttr in attrData)
            {
                context.AddReference(AssetIdentifier.FromMemberInfo(custAttr.Constructor));

                var attrElem = new XElement("attribute",
                                            new XAttribute("type",
                                                           AssetIdentifier.FromMemberInfo(
                                                                                          custAttr.Constructor.
                                                                                              ReflectedType ??
                                                                                          custAttr.Constructor.
                                                                                              DeclaringType)),
                                            new XAttribute("constructor",
                                                           AssetIdentifier.FromMemberInfo(custAttr.Constructor)));

                foreach (CustomAttributeTypedArgument cta in custAttr.ConstructorArguments)
                {
                    if (cta.Value is ReadOnlyCollection<CustomAttributeTypedArgument>)
                    {
                        AssetIdentifier elementAssetId =
                            AssetIdentifier.FromMemberInfo(cta.ArgumentType.GetElementType());
                        context.AddReference(elementAssetId);
                        attrElem.Add(new XElement("argument",
                                                  new XElement("array",
                                                               new XAttribute("type", elementAssetId),
                                                               ((IEnumerable<CustomAttributeTypedArgument>)cta.Value).
                                                                   Select(
                                                                          ata =>
                                                                          new XElement("element",
                                                                                       GenerateAttributeArgument(
                                                                                                                 context,
                                                                                                                 ata))))));
                    }
                    else
                    {
                        attrElem.Add(new XElement("argument",
                                                  GenerateAttributeArgument(context, cta)));
                    }
                }

                foreach (CustomAttributeNamedArgument cta in custAttr.NamedArguments)
                {
                    AssetIdentifier namedMember = AssetIdentifier.FromMemberInfo(cta.MemberInfo);
                    context.AddReference(namedMember);

                    if (cta.TypedValue.Value is ReadOnlyCollection<CustomAttributeTypedArgument>)
                    {
                        context.AddReference(namedMember);
                        AssetIdentifier elementAssetId =
                            AssetIdentifier.FromMemberInfo(cta.TypedValue.ArgumentType.GetElementType());
                        context.AddReference(elementAssetId);
                        attrElem.Add(new XElement("argument",
                                                  new XAttribute("member", namedMember),
                                                  new XElement("array",
                                                               new XAttribute("type", elementAssetId),
                                                               ((IEnumerable<CustomAttributeTypedArgument>)
                                                                cta.TypedValue.Value).Select(
                                                                                             ata =>
                                                                                             new XElement("element",
                                                                                                          GenerateAttributeArgument
                                                                                                              (context,
                                                                                                               ata))))));
                    }
                    else
                    {
                        attrElem.Add(new XElement("argument",
                                                  new XAttribute("member", namedMember),
                                                  GenerateAttributeArgument(context, cta.TypedValue)));
                    }
                }


                context.Element.Add(attrElem);
            }
        }
开发者ID:abclassic,项目名称:LBi.LostDoc,代码行数:77,代码来源:AttributeDataEnricher.cs

示例5: GenerateTypeRef

        public static void GenerateTypeRef(IProcessingContext context, Type pType, string attrName = null)
        {
            if (pType.IsArray)
            {
                var arrayElem = new XElement("arrayOf", new XAttribute("rank", pType.GetArrayRank()));
                context.Element.Add(arrayElem);
                GenerateTypeRef(context.Clone(arrayElem), pType.GetElementType());
            }
            else
            {
                if (pType.IsGenericParameter)
                    context.Element.Add(new XAttribute("param", pType.Name));
                else if (pType.IsGenericType)
                {
                    AssetIdentifier aid = AssetIdentifier.FromType(pType.GetGenericTypeDefinition());
                    context.AddReference(aid);

                    context.Element.Add(new XAttribute(attrName ?? "type", aid));
                    foreach (Type genArg in pType.GetGenericArguments())
                    {
                        XElement argElem = new XElement("with");
                        GenerateTypeRef(context.Clone(argElem), genArg);
                        context.Element.Add(argElem);
                    }
                }
                else
                {
                    AssetIdentifier aid = AssetIdentifier.FromMemberInfo(pType);
                    context.AddReference(aid);

                    context.Element.Add(new XAttribute(attrName ?? "type", aid));
                }
            }
        }
开发者ID:LBi-Dick,项目名称:LBi.LostDoc,代码行数:34,代码来源:DocGenerator.cs

示例6: GenerateAttributeArgument

        private static IEnumerable<XObject> GenerateAttributeArgument(IProcessingContext context,
                                                                      CustomAttributeTypedArgument cata)
        {
            context.AddReference(AssetIdentifier.FromMemberInfo(cata.ArgumentType));
            yield return new XAttribute("type", AssetIdentifier.FromMemberInfo(cata.ArgumentType));

            if (cata.ArgumentType.IsEnum)
            {
                if (
                    cata.ArgumentType.GetCustomAttributesData().Any(
                                                                    ca =>
                                                                    ca.Constructor.DeclaringType ==
                                                                    typeof(FlagsAttribute)))
                {
                    var parts = GetEnumFlags(cata.ArgumentType, cata.Value).ToArray();

                    yield return
                        new XElement("enum",
                                     Array.ConvertAll(parts,
                                                      s => new XElement("flag", new XAttribute("value", s.Trim()))));
                }
                else
                {
                    var val = Enum.GetName(cata.ArgumentType, cata.Value) ?? "";
                    yield return
                        new XElement("enum", new XAttribute("value", val));
                }
            }
            else if (cata.ArgumentType == typeof(Type))
            {
                XElement tmp = new XElement("tmp");
                DocGenerator.GenerateTypeRef(context.Clone(tmp), (Type)cata.Value, "value");
                yield return tmp.Attribute("value");
                foreach (XElement xElement in tmp.Elements())
                    yield return xElement;


// yield return new XAttribute("value", AssetIdentifier.FromMemberInfo((Type)cata.Value));
            }
            else
                yield return new XAttribute("value", cata.Value.ToString());
        }
开发者ID:abclassic,项目名称:LBi.LostDoc,代码行数:42,代码来源:AttributeDataEnricher.cs

示例7: GenerateTypeElement

        private XElement GenerateTypeElement(IProcessingContext context, Asset asset)
        {
            XElement ret;
            Type type = (Type)asset.Target;

            string elemName;

            if (type.IsClass)
                elemName = "class";
            else if (type.IsEnum)
                elemName = "enum";
            else if (type.IsValueType)
                elemName = "struct";
            else if (type.IsInterface)
                elemName = "interface";
            else
                throw new ArgumentException("Unknown asset type: " + asset.Type.ToString(), "asset");

            //XTypeBuilder typeBuilder = new XTypeBuilder(type.Name, asset.Id, context.Phase);
            //typeBuilder.A
            //ret = typeBuilder.ToElement();

            ret = new XElement(elemName,
                               new XAttribute("name", type.Name),
                               new XAttribute("assetId", asset.Id),
                               new XAttribute("phase", context.Phase));

            if (type.IsEnum)
            {
                Type underlyingType = type.GetEnumUnderlyingType();
                AssetIdentifier aid = AssetIdentifier.FromType(underlyingType);
                ret.Add(new XAttribute("underlyingType", aid));
                context.AddReference(new Asset(aid, underlyingType));
            }


            if (!type.IsInterface && type.IsAbstract)
                ret.Add(new XAttribute("isAbstract", XmlConvert.ToString(type.IsAbstract)));

            if (!type.IsVisible || type.IsNested && type.IsNestedAssembly)
                ret.Add(new XAttribute("isInternal", XmlConvert.ToString(true)));

            if (type.IsPublic || type.IsNested && type.IsNestedPublic)
                ret.Add(new XAttribute("isPublic", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedPrivate)
                ret.Add(new XAttribute("isPrivate", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamily)
                ret.Add(new XAttribute("isProtected", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamANDAssem)
                ret.Add(new XAttribute("isProtectedAndInternal", XmlConvert.ToString(true)));

            if (type.IsNested && type.IsNestedFamORAssem)
                ret.Add(new XAttribute("isProtectedOrInternal", XmlConvert.ToString(true)));

            if (type.IsClass && type.IsSealed)
                ret.Add(new XAttribute("isSealed", XmlConvert.ToString(true)));

            if (type.BaseType != null)
            {
                AssetIdentifier baseAid = AssetIdentifier.FromType(type.BaseType);
                Asset baseAsset = new Asset(baseAid, type.BaseType);
                if (!context.IsFiltered(baseAsset))
                {
                    var inheritsElem = new XElement("inherits");
                    ret.Add(inheritsElem);
                    GenerateTypeRef(context.Clone(inheritsElem), type.BaseType);
                }
            }

            if (type.ContainsGenericParameters)
            {
                Type[] typeParams = type.GetGenericArguments();
                if (type.IsNested && type.DeclaringType.ContainsGenericParameters)
                {
                    Type[] inheritedTypeParams = type.DeclaringType.GetGenericArguments();

                    Debug.Assert(typeParams.Length >= inheritedTypeParams.Length);

                    for (int paramPos = 0; paramPos < inheritedTypeParams.Length; paramPos++)
                    {
                        Debug.Assert(typeParams[paramPos].Name == inheritedTypeParams[paramPos].Name);
                        Debug.Assert(typeParams[paramPos].GenericParameterAttributes == inheritedTypeParams[paramPos].GenericParameterAttributes);
                    }

                    Type[] declaredTypeParams = new Type[typeParams.Length - inheritedTypeParams.Length];

                    for (int paramPos = inheritedTypeParams.Length; paramPos < typeParams.Length; paramPos++)
                    {
                        declaredTypeParams[paramPos - inheritedTypeParams.Length] = typeParams[paramPos];
                    }

                    typeParams = declaredTypeParams;
                }

                foreach (Type tp in typeParams)
                {
                    this.GenerateTypeParamElement(context.Clone(ret), type, tp);
//.........这里部分代码省略.........
开发者ID:LBiNetherlands,项目名称:LBi.LostDoc,代码行数:101,代码来源:DocGenerator.cs

示例8: GenerateTypeRef

        public static void GenerateTypeRef(IProcessingContext context, Type pType, string attrName = null)
        {
            // TODO rethink how we generate the typerefs, probably ensure we always output a root element rather than just the attribute for param/type
            if (pType.IsArray)
            {
                // TODO arrayOf is the only capitalized element
                var arrayElem = new XElement("arrayOf", new XAttribute("rank", pType.GetArrayRank()));
                context.Element.Add(arrayElem);
                GenerateTypeRef(context.Clone(arrayElem), pType.GetElementType());
            }
            else
            {
                if (pType.IsGenericParameter)
                    context.Element.Add(new XAttribute("param", pType.Name));
                else if (pType.IsGenericType)
                {
                    Type typeDefinition = pType.GetGenericTypeDefinition();
                    AssetIdentifier aid = AssetIdentifier.FromType(typeDefinition);
                    context.AddReference(new Asset(aid, typeDefinition));

                    context.Element.Add(new XAttribute(attrName ?? "type", aid));
                    foreach (Type genArg in pType.GetGenericArguments())
                    {
                        XElement argElem = new XElement("with");
                        GenerateTypeRef(context.Clone(argElem), genArg);
                        context.Element.Add(argElem);
                    }
                }
                else
                {
                    AssetIdentifier aid = AssetIdentifier.FromMemberInfo(pType);
                    context.AddReference(new Asset(aid, pType));

                    context.Element.Add(new XAttribute(attrName ?? "type", aid));
                }
            }
        }
开发者ID:LBiNetherlands,项目名称:LBi.LostDoc,代码行数:37,代码来源:DocGenerator.cs

示例9: GenerateAttributeElements

        protected virtual void GenerateAttributeElements(IProcessingContext context, IEnumerable<CustomAttributeData> attrData)
        {
            foreach (CustomAttributeData custAttr in attrData)
            {
                Type originatingType = custAttr.Constructor.ReflectedType
                                       ?? custAttr.Constructor.DeclaringType;

                Asset typeAsset = ReflectionServices.GetAsset(originatingType);

                if (context.IsFiltered(typeAsset))
                    continue;

                Asset ctorAsset = ReflectionServices.GetAsset(custAttr.Constructor);
                context.AddReference(ctorAsset);

                var attrElem = new XElement("attribute",
                                            new XAttribute("type", typeAsset.Id),
                                            new XAttribute("constructor", ctorAsset.Id));

                foreach (CustomAttributeTypedArgument cta in custAttr.ConstructorArguments)
                {
                    XElement argElem = new XElement("argument");

                    this.GenerateValueLiteral(context.Clone(argElem), cta);

                    attrElem.Add(argElem);
                }

                foreach (CustomAttributeNamedArgument cta in custAttr.NamedArguments)
                {
                    Asset asset = ReflectionServices.GetAsset(cta.MemberInfo);
                    context.AddReference(asset);

                    XElement argElem = new XElement("argument",
                                                    new XAttribute("member", asset.Id));

                    this.GenerateValueLiteral(context.Clone(argElem), cta.TypedValue);

                    attrElem.Add(argElem);
                }


                context.Element.Add(attrElem);
            }
        }
开发者ID:LBiNetherlands,项目名称:LBi.LostDoc,代码行数:45,代码来源:AttributeDataEnricher.cs

示例10: GenerateAttributeArgument

        private static IEnumerable<XObject> GenerateAttributeArgument(IProcessingContext context,
                                                                      CustomAttributeTypedArgument cata)
        {
            // TODO this needs to be cleaned up, and fixed
            context.AddReference(AssetIdentifier.FromMemberInfo(cata.ArgumentType));
            yield return new XAttribute("type", AssetIdentifier.FromMemberInfo(cata.ArgumentType));

            if (cata.ArgumentType.IsEnum)
            {
                if (
                    cata.ArgumentType.GetCustomAttributesData().Any(
                                                                    ca =>
                                                                    ca.Constructor.DeclaringType ==
                                                                    typeof(FlagsAttribute)))
                {
                    string flags = Enum.ToObject(cata.ArgumentType, cata.Value).ToString();
                    string[] parts = flags.Split(',');

                    yield return
                        new XElement("literal",
                                     new XAttribute("value", cata.Value),
                                     Array.ConvertAll(parts,
                                                      s => new XElement("flag", new XAttribute("value", s.Trim()))));
                }
                else
                {
                    string value = Enum.GetName(cata.ArgumentType, cata.Value);
                    if (value != null)
                        yield return new XElement("literal", new XAttribute("value", value));

                    yield return new XElement("literal", new XAttribute("value", cata.Value));
                }
            }
            else if (cata.ArgumentType == typeof(Type))
            {
                XElement tmp = new XElement("tmp");
                DocGenerator.GenerateTypeRef(context.Clone(tmp), (Type)cata.Value, "value");
                yield return tmp.Attribute("value");
                foreach (XElement xElement in tmp.Elements())
                    yield return xElement;

            }
            else // TODO fix how this encodes unprintable characters 
                yield return new XAttribute("value", cata.Value.ToString().Replace("\0", "\\0"));
        }
开发者ID:LBi-Dick,项目名称:LBi.LostDoc,代码行数:45,代码来源:AttributeDataEnricher.cs


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