本文整理汇总了C#中SyntaxWriter.WriteReferenceLink方法的典型用法代码示例。如果您正苦于以下问题:C# SyntaxWriter.WriteReferenceLink方法的具体用法?C# SyntaxWriter.WriteReferenceLink怎么用?C# SyntaxWriter.WriteReferenceLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SyntaxWriter
的用法示例。
在下文中一共展示了SyntaxWriter.WriteReferenceLink方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteAttribute
// Attributes
// !EFW - Added newLine parameter
private static void WriteAttribute(string reference, bool newLine, SyntaxWriter writer)
{
writer.WriteString("[<");
writer.WriteReferenceLink(reference);
writer.WriteString(">]");
if(newLine)
writer.WriteLine();
}
示例2: WriteNormalTypeReference
/// <inheritdoc />
protected override void WriteNormalTypeReference(string api, SyntaxWriter writer)
{
switch(api)
{
case "T:System.Void":
writer.WriteReferenceLink(api, "unit");
break;
case "T:System.String":
writer.WriteReferenceLink(api, "string");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(api, "bool");
break;
case "T:System.Byte":
writer.WriteReferenceLink(api, "byte");
break;
case "T:System.SByte":
writer.WriteReferenceLink(api, "sbyte");
break;
case "T:System.Char":
writer.WriteReferenceLink(api, "char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(api, "int16");
break;
case "T:System.Int32":
writer.WriteReferenceLink(api, "int");
break;
case "T:System.Int64":
writer.WriteReferenceLink(api, "int64");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(api, "uint16");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(api, "uint32");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(api, "uint64");
break;
case "T:System.Single":
writer.WriteReferenceLink(api, "float32");
break;
case "T:System.Double":
writer.WriteReferenceLink(api, "float");
break;
case "T:System.Decimal":
writer.WriteReferenceLink(api, "decimal");
break;
default:
writer.WriteReferenceLink(api);
break;
}
}
示例3: WriteEventSyntax
/// <inheritdoc />
public override void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer)
{
// !EFW - Added unsafe check
if(IsUnsupportedUnsafe(reflection, writer))
return;
string name = (string)reflection.Evaluate(apiNameExpression);
XPathNavigator handler = reflection.SelectSingleNode(apiHandlerOfEventExpression);
XPathNavigator args = reflection.SelectSingleNode(apiEventArgsExpression);
bool isVirtual = (bool)reflection.Evaluate(apiIsVirtualExpression) && !(bool)reflection.Evaluate(apiIsAbstractProcedureExpression);
int iterations = isVirtual ? 2 : 1;
for(int i = 0; i < iterations; i++)
{
WriteAttributes(reflection, writer);
WriteVisibility(reflection, writer);
if(isVirtual)
if(i == 0)
{
writer.WriteKeyword("abstract");
writer.WriteString(" ");
}
else
{
writer.WriteKeyword("override");
writer.WriteString(" ");
}
else
{
WriteMemberKeyword(reflection, writer);
}
writer.WriteIdentifier(name);
writer.WriteString(" : ");
writer.WriteReferenceLink("T:Microsoft.FSharp.Control.IEvent`2");
writer.WriteString("<");
WriteTypeReference(handler, writer);
writer.WriteString(",");
writer.WriteLine();
writer.WriteString(" ");
if(args == null)
{
writer.WriteReferenceLink("T:System.EventArgs");
}
else
{
WriteTypeReference(args, writer);
}
writer.WriteString(">");
if(i == 0)
writer.WriteLine();
}
}
示例4: WriteMemberReference
private static void WriteMemberReference(XPathNavigator member, SyntaxWriter writer)
{
string api = member.GetAttribute("api", String.Empty);
writer.WriteReferenceLink(api);
}
示例5: WriteAttribute
private void WriteAttribute(string reference, bool newLine, SyntaxWriter writer)
{
writer.WriteString("<");
writer.WriteReferenceLink(reference);
writer.WriteString(">");
if(newLine)
{
if(includeLineContinuation)
writer.WriteString(" _");
writer.WriteLine();
}
}
示例6: WriteNormalTypeReference
private static void WriteNormalTypeReference(string reference, SyntaxWriter writer)
{
switch(reference)
{
case "T:System.Void":
writer.WriteReferenceLink(reference, "void");
break;
case "T:System.String":
writer.WriteReferenceLink(reference, "string");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(reference, "bool");
break;
case "T:System.Byte":
writer.WriteReferenceLink(reference, "byte");
break;
case "T:System.SByte":
writer.WriteReferenceLink(reference, "sbyte");
break;
case "T:System.Char":
writer.WriteReferenceLink(reference, "char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(reference, "short");
break;
case "T:System.Int32":
writer.WriteReferenceLink(reference, "int");
break;
case "T:System.Int64":
writer.WriteReferenceLink(reference, "long");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(reference, "ushort");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(reference, "uint");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(reference, "ulong");
break;
case "T:System.Single":
writer.WriteReferenceLink(reference, "float");
break;
case "T:System.Double":
writer.WriteReferenceLink(reference, "double");
break;
case "T:System.Decimal":
writer.WriteReferenceLink(reference, "decimal");
break;
default:
writer.WriteReferenceLink(reference);
break;
}
}
示例7: WriteNormalTypeReference
private static void WriteNormalTypeReference(string reference, SyntaxWriter writer)
{
switch(reference)
{
case "T:System.Int16":
writer.WriteReferenceLink(reference, "Short");
break;
case "T:System.Int32":
writer.WriteReferenceLink(reference, "Integer");
break;
case "T:System.Int64":
writer.WriteReferenceLink(reference, "Long");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(reference, "UShort");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(reference, "UInteger");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(reference, "ULong");
break;
default:
writer.WriteReferenceLink(reference);
break;
}
}
示例8: WriteAttribute
private static void WriteAttribute(string reference, SyntaxWriter writer, bool newline)
{
writer.WriteString("/** @attribute ");
writer.WriteReferenceLink(reference);
writer.WriteString(" */ ");
if(newline)
writer.WriteLine();
}
示例9: ObjectElementUsageForClassStruct
private void ObjectElementUsageForClassStruct(XPathNavigator reflection, SyntaxWriter writer)
{
string typeName = (string)reflection.Evaluate(apiNameExpression);
bool isGeneric = (bool)reflection.Evaluate(apiIsGenericExpression);
string xamlBlockId = System.Enum.GetName(typeof(XamlHeadingID), XamlHeadingID.xamlObjectElementUsageHeading);
string contentPropertyId = (string)reflection.Evaluate(contentPropertyIdExpression);
if(String.IsNullOrEmpty(contentPropertyId))
contentPropertyId = (string)reflection.Evaluate(ancestorContentPropertyIdExpression);
// start the syntax block
writer.WriteStartSubBlock(xamlBlockId);
writer.WriteString("<");
if(isGeneric)
{
writer.WriteIdentifier(typeName);
// for generic types show the type arguments
XPathNodeIterator templates = (XPathNodeIterator)reflection.Evaluate(apiTemplatesExpression);
if(templates.Count > 0)
{
writer.WriteString(" x:TypeArguments=\"");
while(templates.MoveNext())
{
XPathNavigator template = templates.Current;
string name = template.GetAttribute("name", String.Empty);
writer.WriteString(name);
if(templates.CurrentPosition < templates.Count)
writer.WriteString(",");
}
writer.WriteString("\"");
}
}
else
{
// for non-generic types just show the name
writer.WriteIdentifier(typeName);
}
if(String.IsNullOrEmpty(contentPropertyId))
writer.WriteString(" .../>");
else
{
// close the start tag
writer.WriteString(">");
// the inner xml of the Object Element syntax for a type with a content property
// is a link to the content property
writer.WriteLine();
writer.WriteString(" ");
writer.WriteReferenceLink(contentPropertyId);
writer.WriteLine();
// write the end tag
writer.WriteString("</");
writer.WriteIdentifier(typeName);
writer.WriteString(">");
}
// end the sub block
writer.WriteEndSubBlock();
}
示例10: WriteStructureSyntax
/// <inheritdoc />
public override void WriteStructureSyntax(XPathNavigator reflection, SyntaxWriter writer)
{
if(IsUnsupportedGeneric(reflection, writer))
return;
string name = (string)reflection.Evaluate(apiNameExpression);
bool isSerializable = (bool)reflection.Evaluate(apiIsSerializableTypeExpression);
if(isSerializable)
WriteAttribute("T:System.SerializableAttribute", writer);
WriteAttributes(reflection, writer);
WriteVisibility(reflection, writer);
writer.WriteString(" ");
writer.WriteKeyword("final");
writer.WriteString(" ");
writer.WriteKeyword("class");
writer.WriteString(" ");
writer.WriteIdentifier(name);
writer.WriteString(" ");
writer.WriteKeyword("extends");
writer.WriteString(" ");
writer.WriteReferenceLink("T:System.ValueType");
WriteImplementedInterfaces(reflection, writer);
}
示例11: WriteNormalTypeReference
/// <inheritdoc />
protected override void WriteNormalTypeReference(string api, SyntaxWriter writer)
{
switch(api)
{
case "T:System.Byte":
writer.WriteReferenceLink(api, "Byte");
break;
case "T:System.SByte":
writer.WriteReferenceLink(api, "SByte");
break;
case "T:System.Char":
writer.WriteReferenceLink(api, "Char");
break;
case "T:System.Int16":
writer.WriteReferenceLink(api, "Int16");
break;
case "T:System.Int32":
writer.WriteReferenceLink(api, "Int32");
break;
case "T:System.Int64":
writer.WriteReferenceLink(api, "Int64");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(api, "UInt16");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(api, "UInt32");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(api, "UInt64");
break;
case "T:System.Single":
writer.WriteReferenceLink(api, "Single");
break;
case "T:System.Double":
writer.WriteReferenceLink(api, "Double");
break;
case "T:System.Decimal":
writer.WriteReferenceLink(api, "Decimal");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(api, "Boolean");
break;
default:
{
string text = api.Substring(2);
if(text.StartsWith("System.", StringComparison.Ordinal))
{
int num = text.LastIndexOf('.');
text = text.Substring(num + 1);
}
writer.WriteReferenceLink(api, text);
break;
}
}
}
示例12: WriteEventSyntax
/// <summary>
/// Write out event syntax
/// </summary>
/// <param name="reflection">An XPath navigator containing the member information</param>
/// <param name="writer">The syntax writer to which the information is written</param>
/// <param name="prefix">The web control prefix to use</param>
private static void WriteEventSyntax(XPathNavigator reflection, SyntaxWriter writer, string prefix)
{
string name = (string)reflection.Evaluate(nameExpression);
string declaringType = (string)reflection.Evaluate(declaringTypeExpression);
string handlerType = (string)reflection.Evaluate(eventHandlerTypeExpression);
writer.WriteStartBlock(LanguageName, StyleIdName);
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(" ");
writer.WriteString("On");
writer.WriteString(name);
writer.WriteString("=\"");
writer.WriteReferenceLink(handlerType);
writer.WriteString("\" />");
writer.WriteEndBlock();
}
示例13: WritePropertySyntax
/// <summary>
/// Write out property syntax
/// </summary>
/// <param name="reflection">An XPath navigator containing the member information</param>
/// <param name="writer">The syntax writer to which the information is written</param>
/// <param name="prefix">The web control prefix to use</param>
private static void WritePropertySyntax(XPathNavigator reflection, SyntaxWriter writer, string prefix)
{
bool set = (bool)reflection.Evaluate(propertyIsSettable);
if(!set)
return;
string name = (string)reflection.Evaluate(nameExpression);
string declaringType = (string)reflection.Evaluate(declaringTypeExpression);
string propertyType = (string)reflection.Evaluate(propertyTypeExpression);
bool isInnerProperty = (bool)reflection.Evaluate(propertyIsInnerProperty);
writer.WriteStartBlock(LanguageName, StyleIdName);
if(isInnerProperty)
{
// inner property logic
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(">");
writer.WriteLine();
writer.WriteString("\t");
writer.WriteString("<");
writer.WriteString(name);
writer.WriteString(">");
if(String.IsNullOrEmpty(propertyType))
writer.WriteParameter("value");
else
if(propertyType == "T:System.Boolean")
writer.WriteString("True|False");
else
writer.WriteReferenceLink(propertyType);
writer.WriteString("</");
writer.WriteString(name);
writer.WriteString(">");
writer.WriteLine();
writer.WriteString("</");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(">");
}
else
{
// normal property logic
writer.WriteString("<");
writer.WriteString(prefix);
writer.WriteString(":");
writer.WriteReferenceLink(declaringType);
writer.WriteString(" ");
writer.WriteString(name);
writer.WriteString("=\"");
if(String.IsNullOrEmpty(propertyType))
writer.WriteParameter("value");
else
if(propertyType == "T:System.Boolean")
writer.WriteString("True|False");
else
writer.WriteReferenceLink(propertyType);
writer.WriteString("\" />");
}
writer.WriteEndBlock();
}
示例14: WriteNormalTypeReference
/// <inheritdoc />
protected override void WriteNormalTypeReference(string reference, SyntaxWriter writer)
{
switch(reference)
{
case "T:System.Void":
writer.WriteReferenceLink(reference, "void");
break;
case "T:System.Boolean":
writer.WriteReferenceLink(reference, "bool");
break;
case "T:System.Byte":
writer.WriteReferenceLink(reference, "unsigned char");
break;
case "T:System.SByte":
writer.WriteReferenceLink(reference, "signed char");
break;
case "T:System.Char":
writer.WriteReferenceLink(reference, "wchar_t");
break;
case "T:System.Int16":
writer.WriteReferenceLink(reference, "short");
break;
case "T:System.Int32":
writer.WriteReferenceLink(reference, "int");
break;
case "T:System.Int64":
writer.WriteReferenceLink(reference, "long long");
break;
case "T:System.UInt16":
writer.WriteReferenceLink(reference, "unsigned short");
break;
case "T:System.UInt32":
writer.WriteReferenceLink(reference, "unsigned int");
break;
case "T:System.UInt64":
writer.WriteReferenceLink(reference, "unsigned long long");
break;
case "T:System.Single":
writer.WriteReferenceLink(reference, "float");
break;
case "T:System.Double":
writer.WriteReferenceLink(reference, "double");
break;
default:
writer.WriteReferenceLink(reference);
break;
}
}