本文整理汇总了C#中Altaxo.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.Add方法的具体用法?C# Altaxo.Add怎么用?C# Altaxo.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo
的用法示例。
在下文中一共展示了Altaxo.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveNonNumericCells
/// <summary>
/// For given selected columns and selected rows, the procedure removes all nonnumeric cells. Furthermore, if either selectedColumns or selectedRows
/// is empty, the collection is filled by the really used rows/columns.
/// </summary>
/// <param name="srctable">The source table.</param>
/// <param name="selectedRows">On entry, contains the selectedRows (or empty if now rows selected). On output, is the row collection.</param>
/// <param name="selectedColumns">On entry, conains the selected columns (or emtpy if only rows selected). On output, contains all numeric columns.</param>
public static void RemoveNonNumericCells(Altaxo.Data.DataTable srctable, Altaxo.Collections.AscendingIntegerCollection selectedRows, Altaxo.Collections.AscendingIntegerCollection selectedColumns)
{
// first the columns
if (0 != selectedColumns.Count)
{
for (int i = 0; i < selectedColumns.Count; i++)
{
int idx = selectedColumns[i];
if (!(srctable[idx] is Altaxo.Data.INumericColumn))
{
selectedColumns.Remove(idx);
}
}
}
else // if no columns where selected, select all that are numeric
{
int end = srctable.DataColumnCount;
for (int i = 0; i < end; i++)
{
if (srctable[i] is Altaxo.Data.INumericColumn)
selectedColumns.Add(i);
}
}
// if now rows selected, then test the max row count of the selected columns
// and add it
// check the number of rows
if (0 == selectedRows.Count)
{
int numrows = 0;
int end = selectedColumns.Count;
for (int i = 0; i < end; i++)
{
int idx = selectedColumns[i];
numrows = Math.Max(numrows, srctable[idx].Count);
}
selectedRows.Add(ContiguousIntegerRange.FromStartAndCount(0, numrows));
}
}
示例2: ExtractPropertiesFromString
/// <summary>
/// This function searches for patterns like aaa=bbb in the provided string. If it finds such a item, it creates a column named aaa
/// and stores the value bbb at the same position in it as in the text column.
/// </summary>
/// <param name="strg">The string where to search for the patterns described above.</param>
/// <param name="store">The column collection where to store the newly created columns of properties.</param>
/// <param name="index">The index into the column where to store the property value.</param>
public static void ExtractPropertiesFromString(string strg, Altaxo.Data.DataColumnCollection store, int index)
{
string pat;
pat = @"(\S+)=(\S+)";
Regex r = new Regex(pat, RegexOptions.Compiled | RegexOptions.IgnoreCase);
for ( Match m = r.Match(strg); m.Success; m = m.NextMatch())
{
string propname = m.Groups[1].ToString();
string propvalue = m.Groups[2].ToString();
// System.Diagnostics.Trace.WriteLine("Found the pair " + propname + " : " + propvalue);
if(!store.ContainsColumn(propname))
{
Altaxo.Data.DataColumn col;
if(Altaxo.Serialization.DateTimeParsing.IsDateTime(propvalue))
col = new Altaxo.Data.DateTimeColumn();
else if(Altaxo.Serialization.NumberConversion.IsNumeric(propvalue))
col = new Altaxo.Data.DoubleColumn();
else
col = new Altaxo.Data.TextColumn();
store.Add(col,propname); // add the column to the collection
}
// now the column is present we can store the value in it.
store[propname][index] = new Altaxo.Data.AltaxoVariant(propvalue);
}
}