本文整理汇总了C#中System.Xml.XmlWriter.WriteAttributeIfNotEmpty方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteAttributeIfNotEmpty方法的具体用法?C# XmlWriter.WriteAttributeIfNotEmpty怎么用?C# XmlWriter.WriteAttributeIfNotEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteAttributeIfNotEmpty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty(InstanceElement.NamePropertyName, this.Name)
.WriteAttributeIfNotEmpty(InstanceElement.ValuePropertyName, this.Value)
.WriteAttributeIfNotEmpty(InstanceElement.TypeNamePropertyName, this.TypeName)
.WriteAttributeIfNotEmpty(InstanceElement.TypeConverterTypeNamePropertyName, this.TypeConverterTypeName);
}
示例2: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, this.TypeName);
foreach (var valueElement in this.Values)
{
ValueElementHelper.SerializeParameterValueElement(writer, valueElement, true);
}
}
示例3: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
base.SerializeContent(writer);
writer.WriteAttributeIfNotEmpty(NamePropertyName, Name);
}
示例4: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeString(NamePropertyName, Name);
writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, TypeName);
if(LifetimeIsPresent())
{
writer.WriteElement("lifetime", Lifetime.SerializeContent);
}
foreach(var injectionElement in Injection)
{
writer.WriteElement(injectionElement.ElementName, injectionElement.SerializeContent);
}
}
示例5: SerializeContent
///<summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>. This
/// method always outputs an explicit <dependency> tag, instead of providing
/// attributes to the parent method.
///</summary>
///<param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty(NamePropertyName, Name)
.WriteAttributeIfNotEmpty(TypeNamePropertyName, TypeName);
}
示例6:
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
void IAttributeOnlyElement.SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty("dependencyName", Name)
.WriteAttributeIfNotEmpty("dependencyType", TypeName);
}
示例7: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
Guard.ArgumentNotNull(writer, "writer");
writer.WriteAttributeString(NamePropertyName, Name);
writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, TypeName);
ValueElementHelper.SerializeParameterValueElement(writer, Value, false);
}
示例8: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty(OptionalElement.NamePropertyName, this.Name)
.WriteAttributeIfNotEmpty(OptionalElement.TypeNamePropertyName, this.TypeName);
}
示例9: SerializeContent
public override void SerializeContent(XmlWriter writer)
{
Guard.ArgumentNotNull(writer, "writer");
writer.WriteAttributeIfNotEmpty(NamePropertyName, Name);
writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, TypeName);
if(IsDefaultForType)
{
writer.WriteAttributeString(IsDefaultForTypePropertyName, IsDefaultForType.ToString());
}
}
示例10: SerializeContent
public override void SerializeContent(XmlWriter writer)
{
Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");
writer.WriteAttributeString(TypePropertyName, TypeName);
writer.WriteAttributeIfNotEmpty(MapToPropertyName, MapToName)
.WriteAttributeIfNotEmpty(NamePropertyName, Name);
if(!string.IsNullOrEmpty(Lifetime.TypeName))
{
writer.WriteElement("lifetime", Lifetime.SerializeContent);
}
SerializeInjectionMembers(writer);
}
示例11: Serialize
/// <summary>
/// Serializes the specified XML writer.
/// </summary>
/// <param name="xmlWriter">The XML writer.</param>
public virtual void Serialize(XmlWriter xmlWriter)
{
xmlWriter.WriteAttributeString("id", Id.ToString());
xmlWriter.WriteAttributeString("type", Type.ToString());
xmlWriter.WriteAttributeString("expressionName", ExpressionName);
xmlWriter.WriteAttributeString("uniqueName", UniqueName);
xmlWriter.WriteAttributeIfNotEmpty("functionName", FunctionName);
xmlWriter.WriteAttributeString("left", Left.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteAttributeString("top", Top.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteAttributeString("width", Width.ToString(CultureInfo.InvariantCulture));
xmlWriter.WriteAttributeString("height", Height.ToString(CultureInfo.InvariantCulture));
}
示例12: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeIfNotEmpty(NamePropertyName, Name);
Extensions.SerializeElementContents(writer, "extension");
Registrations.SerializeElementContents(writer, "register");
Instances.SerializeElementContents(writer, "instance");
SerializeContainerConfiguringElements(writer);
}
示例13: SerializeContent
public override void SerializeContent(XmlWriter writer)
{
Microsoft.Practices.Unity.Utility.Guard.ArgumentNotNull(writer, "writer");
writer.WriteAttributeString(NamePropertyName, this.Name);
writer.WriteAttributeIfNotEmpty(TypeNamePropertyName, this.TypeName);
if (this.LifetimeIsPresent())
{
writer.WriteElement("lifetime", this.Lifetime.SerializeContent);
}
foreach (var injectionElement in this.Injection)
{
writer.WriteElement(injectionElement.ElementName, injectionElement.SerializeContent);
}
}
示例14: Serialize
/// <summary>
/// Serializes the specified XML writer.
/// </summary>
/// <param name="xmlWriter">The XML writer.</param>
public void Serialize(XmlWriter xmlWriter)
{
xmlWriter.WriteAttributeString("id", Id.ToString());
xmlWriter.WriteAttributeString("name", Name);
xmlWriter.WriteAttributeString("dataType", DataType.ToString());
xmlWriter.WriteAttributeIfNotEmpty("innerName", InnerName);
xmlWriter.WriteAttributeIfNotEmpty("setName", SetName);
xmlWriter.WriteAttributeIfNotEmpty("systemName", SystemName);
xmlWriter.WriteAttributeIfNotEmpty("objectName", GetObjectName());
xmlWriter.WriteAttributeIfNotEmpty("uniqueName", UniqueName);
xmlWriter.WriteAttributeIfNotEmpty("keepSubfieldsAlive", KeepSubfieldsAlive ? Boolean.TrueString : Boolean.FalseString);
xmlWriter.WriteAttributeIfNotEmpty("hideConnector", HideConnector ? Boolean.TrueString : Boolean.FalseString);
xmlWriter.WriteAttributeIfNotEmpty("isGroupingField", IsGroupingField ? Boolean.TrueString : Boolean.FalseString);
xmlWriter.WriteAttributeIfNotEmpty("isGroupCollapsed", IsGroupCollapsed ? Boolean.TrueString : Boolean.FalseString);
xmlWriter.WriteStartElement("ConnectorOut");
ConnectorOut.Serialize(xmlWriter);
xmlWriter.WriteEndElement();
if (AdditionalInfo != null)
{
xmlWriter.WriteStartElement("AdditionalInfo");
AdditionalInfo.Serialize(xmlWriter);
xmlWriter.WriteEndElement();
}
if (_subfields != null && _subfields.Any())
{
xmlWriter.WriteStartElement("Subfields");
foreach (var subfield in Subfields)
{
xmlWriter.WriteStartElement("SourceField");
((SourceField)subfield).Serialize(xmlWriter);
xmlWriter.WriteEndElement();
}
xmlWriter.WriteEndElement();
}
}
示例15: SerializeContent
/// <summary>
/// Write the contents of this element to the given <see cref="XmlWriter"/>.
/// </summary>
/// <remarks>The caller of this method has already written the start element tag before
/// calling this method, so deriving classes only need to write the element content, not
/// the start or end tags.</remarks>
/// <param name="writer">Writer to send XML content to.</param>
public override void SerializeContent(XmlWriter writer)
{
writer.WriteAttributeString(TypePropertyName, TypeName);
writer.WriteAttributeIfNotEmpty(MapToPropertyName, MapToName)
.WriteAttributeIfNotEmpty(NamePropertyName, Name);
if(!string.IsNullOrEmpty(Lifetime.TypeName))
{
writer.WriteElement("lifetime", Lifetime.SerializeContent);
}
SerializeInjectionMembers(writer);
}