本文整理汇总了C#中System.Xml.XmlWriter.WriteAttributeNullable方法的典型用法代码示例。如果您正苦于以下问题:C# XmlWriter.WriteAttributeNullable方法的具体用法?C# XmlWriter.WriteAttributeNullable怎么用?C# XmlWriter.WriteAttributeNullable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlWriter
的用法示例。
在下文中一共展示了XmlWriter.WriteAttributeNullable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteXml
public override void WriteXml(XmlWriter writer)
{
// Write tag attributes
base.WriteXml(writer);
writer.WriteAttributeIfString(ATTR.aminoacid, AAs);
writer.WriteAttributeNullable(ATTR.terminus, Terminus);
writer.WriteAttribute(ATTR.variable, IsVariable);
writer.WriteAttributeIfString(ATTR.formula, Formula);
writer.WriteAttribute(ATTR.label_13C, Label13C);
writer.WriteAttribute(ATTR.label_15N, Label15N);
writer.WriteAttribute(ATTR.label_18O, Label18O);
writer.WriteAttribute(ATTR.label_2H, Label2H);
writer.WriteAttribute(ATTR.relative_rt, RelativeRT, RelativeRT.Matching);
if (string.IsNullOrEmpty(Formula))
{
writer.WriteAttributeNullable(ATTR.massdiff_monoisotopic, MonoisotopicMass);
writer.WriteAttributeNullable(ATTR.massdiff_average, AverageMass);
}
if (!IsVariable)
writer.WriteAttribute(ATTR.explicit_decl, IsExplicit);
writer.WriteAttributeNullable(ATTR.unimod_id, UnimodId);
writer.WriteAttributeIfString(ATTR.short_name, ShortName);
if (Losses != null)
writer.WriteElements(Losses);
}
示例2: WriteXml
public override void WriteXml(XmlWriter writer)
{
// Write tag attributes
base.WriteXml(writer);
writer.WriteAttribute(ATTR.use_for_retention_time_prediction, false);
writer.WriteAttributeNullable(ATTR.analyte_concentration, AnalyteConcentration);
if (null != SampleType && !Equals(SampleType, SampleType.DEFAULT))
{
writer.WriteAttribute(ATTR.sample_type, SampleType.Name);
}
// Write optimization element, if present
if (OptimizationFunction != null)
{
IXmlElementHelper<OptimizableRegression> helper = XmlUtil.FindHelper(
OptimizationFunction, OPTIMIZATION_HELPERS);
if (helper == null)
throw new InvalidOperationException(Resources.ChromatogramSet_WriteXml_Attempt_to_serialize_list_containing_invalid_type);
writer.WriteElement(helper.ElementNames[0], OptimizationFunction);
}
int i = 0;
foreach (var fileInfo in MSDataFileInfos)
{
writer.WriteStartElement(EL.sample_file);
writer.WriteAttribute(ATTR.id, GetOrdinalSaveId(i++));
writer.WriteAttribute(ATTR.file_path, fileInfo.FilePath);
writer.WriteAttribute(ATTR.sample_name, fileInfo.FilePath.GetSampleOrFileName());
if(fileInfo.RunStartTime != null)
{
writer.WriteAttribute(ATTR.acquired_time, XmlConvert.ToString((DateTime) fileInfo.RunStartTime, "yyyy-MM-ddTHH:mm:ss")); // Not L10N
}
if(fileInfo.FileWriteTime != null)
{
writer.WriteAttribute(ATTR.modified_time, XmlConvert.ToString((DateTime)fileInfo.FileWriteTime, "yyyy-MM-ddTHH:mm:ss")); // Not L10N
}
// instrument information
WriteInstrumentConfigList(writer, fileInfo.InstrumentInfoList);
writer.WriteEndElement();
}
SrmDocument.WriteAnnotations(writer, Annotations);
}
示例3: WriteXml
public void WriteXml(XmlWriter writer)
{
if (Formula != null)
{
writer.WriteAttribute(ATTR.ion_formula, Formula);
writer.WriteAttributeNullable(ATTR.mass_average, AverageMass);
writer.WriteAttributeNullable(ATTR.mass_monoisotopic, MonoisotopicMass);
}
else
{
// Without a formula we can't rederive masses, so write at higher precision
writer.WriteAttributeNullableRoundTrip(ATTR.mass_average, AverageMass);
writer.WriteAttributeNullableRoundTrip(ATTR.mass_monoisotopic, MonoisotopicMass);
}
if (Name != null)
writer.WriteAttribute(ATTR.custom_ion_name, Name);
}
示例4:
void IXmlSerializable.WriteXml(XmlWriter writer)
{
if (null != RegressionWeighting)
{
writer.WriteAttributeString(Attr.weighting, RegressionWeighting.Name);
}
if (null != RegressionFit)
{
writer.WriteAttributeString(Attr.fit, RegressionFit.Name);
}
if (null != NormalizationMethod)
{
writer.WriteAttributeString(Attr.normalization, NormalizationMethod.Name);
}
writer.WriteAttributeNullable(Attr.ms_level, MsLevel);
writer.WriteAttributeIfString(Attr.units, Units);
}
示例5: WriteXml
public void WriteXml(XmlWriter writer)
{
// Write this bool whether it is true or false, to allow its absence
// as a marker of needing default values.
writer.WriteAttribute(ATTR.use_measured_rts, UseMeasuredRTs, !UseMeasuredRTs);
writer.WriteAttributeNullable(ATTR.measured_rt_window, MeasuredRTWindow);
writer.WriteAttribute(ATTR.use_spectral_library_drift_times, UseLibraryDriftTimes, !UseLibraryDriftTimes);
writer.WriteAttributeNullable(ATTR.spectral_library_drift_times_resolving_power, LibraryDriftTimesResolvingPower);
// Write child elements
if (RetentionTime != null)
writer.WriteElement(RetentionTime);
if (DriftTimePredictor != null)
writer.WriteElement(DriftTimePredictor);
}
示例6: WriteXml
public override void WriteXml(XmlWriter writer)
{
// Write tag attributes
base.WriteXml(writer);
if (IsFragment)
{
writer.WriteAttributeString(ATTR.cut, Fragment);
writer.WriteAttributeIfString(ATTR.no_cut, Restrict);
writer.WriteAttributeNullable(ATTR.sense, Terminus);
writer.WriteAttributeNullable(ATTR.min_length, MinFragmentLength);
}
else
{
writer.WriteAttributeIfString(ATTR.ion_formula, SettingsCustomIon.Formula);
// Masses are information only, if their is a formula, but Panorama may need these
writer.WriteAttribute(ATTR.mass_monoisotopic, SettingsCustomIon.MonoisotopicMass);
writer.WriteAttribute(ATTR.mass_average, SettingsCustomIon.AverageMass);
writer.WriteAttributeString(ATTR.charge, Charge.ToString(CultureInfo.InvariantCulture));
writer.WriteAttribute(ATTR.optional, IsOptional);
}
}
示例7: WriteXml
public override void WriteXml(XmlWriter writer)
{
// Write tag attributes.
base.WriteXml(writer);
if (PrecursorRightFilter.HasValue)
{
writer.WriteAttributeNullable(ATTR.precursor_left_filter, PrecursorFilter);
writer.WriteAttributeNullable(ATTR.precursor_right_filter, PrecursorRightFilter);
}
else
{
writer.WriteAttributeNullable(ATTR.precursor_filter, PrecursorFilter);
}
if (!Equals(SpecialHandling, SpecialHandlingType.NONE))
writer.WriteAttribute(ATTR.special_handling, SpecialHandling);
writer.WriteAttributeNullable(ATTR.windows_per_scan, WindowsPerScan);
writer.WriteElements(_prespecifiedIsolationWindows);
}
示例8: WriteXml
public void WriteXml(XmlWriter writer)
{
writer.WriteAttribute(ATTR.start, Start);
writer.WriteAttribute(ATTR.end, End);
writer.WriteAttributeNullable(ATTR.target, Target);
if (StartMargin != null)
{
if (EndMargin != null)
{
writer.WriteAttributeNullable(ATTR.margin_left, StartMargin);
writer.WriteAttributeNullable(ATTR.margin_right, EndMargin);
}
else
{
writer.WriteAttributeNullable(ATTR.margin, StartMargin);
}
}
writer.WriteAttributeNullable(ATTR.ce_range, CERange);
}