本文整理汇总了C#中Altaxo.Data.AltaxoVariant.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# AltaxoVariant.ToString方法的具体用法?C# AltaxoVariant.ToString怎么用?C# AltaxoVariant.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo.Data.AltaxoVariant
的用法示例。
在下文中一共展示了AltaxoVariant.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
try
{
this[i] = val.ToDouble();
}
catch (Exception ex)
{
throw new ApplicationException(string.Format("Error: Try to set {0}[{1}] with the string {2}, exception: {3}", this.TypeAndName, i, val.ToString(), ex.Message));
}
}
示例2: DefaultTextConverter
private string DefaultTextConverter(AltaxoVariant x)
{
string s = x.ToString();
s = s.Replace('\r', ' ');
s = s.Replace('\n', ' ');
return s;
}
示例3: FormatItem
protected override string FormatItem(AltaxoVariant item)
{
if (!string.IsNullOrEmpty(_formatString))
{
try
{
return string.Format(_formatString, item.ToObject());
}
catch (Exception)
{
}
}
return item.ToString();
}
示例4: FromPhysicalVariant
/// <summary>
/// Initialized a 2D identifier from the parallel axis and the physical value of the perpendicular axis.
/// </summary>
/// <param name="parallelAxisNumber">Number of parallel axis (0->X, 1->Y, 2->Z).</param>
/// <param name="physicalValueOther">Physical value of the axis perendicular to the parallel axis.</param>
/// <returns>A freshly created 2D line identifier.</returns>
public static CSLineID FromPhysicalVariant(int parallelAxisNumber, AltaxoVariant physicalValueOther)
{
if (parallelAxisNumber < 0 || parallelAxisNumber > 2)
throw new ArgumentOutOfRangeException("AxisNumber must be either 0, 1, or 2, but you provide: " + parallelAxisNumber.ToString());
if (!physicalValueOther.Equals(physicalValueOther))
throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValueOther.ToString());
CSLineID id = new CSLineID();
id._parallelAxisNumber = parallelAxisNumber;
id._physicalValueFirstOther = physicalValueOther;
id._logicalValueFirstOther = double.NaN;
id._usePhysicalValueFirstOther = true;
id._logicalValueSecondOther = double.NaN;
return id;
}
示例5: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
if(val.IsTypeOrNull(AltaxoVariant.Content.VString))
this[i] = (string)val;
else
this[i] = val.ToString();
// throw new ApplicationException("Error: Try to set " + this.TypeAndName + "[" + i + "] with " + val.ToString());
}
示例6: SetValueAt
// indexers
public override void SetValueAt(int i, AltaxoVariant val)
{
if(val.IsType(AltaxoVariant.Content.VDouble))
this[i] = val.m_Double;
else if(val.CanConvertedToDouble)
this[i] = val.ToDouble();
else
throw new ApplicationException("Error: Try to set " + this.TypeAndName + "[" + i + "] with the string " + val.ToString());
}
示例7: FormatItem
protected override string FormatItem(AltaxoVariant item)
{
if (item.IsType(AltaxoVariant.Content.VDateTime) && !string.IsNullOrEmpty(_formatString))
{
var dt = item.ToDateTime();
switch (_timeConversion)
{
case TimeConversion.ToLocal:
dt = dt.ToLocalTime();
break;
case TimeConversion.ToUtc:
dt = dt.ToUniversalTime();
break;
}
bool showAlternate = false;
showAlternate |= (_showAlternateFormattingAtMidnight && Math.Abs(dt.TimeOfDay.TotalSeconds) < 1);
showAlternate |= (_showAlternateFormattingAtNoon && Math.Abs((dt.TimeOfDay - TimeSpan.FromHours(12)).TotalSeconds) < 1);
try
{
return string.Format(showAlternate ? _formatStringAlternate : _formatString, dt);
}
catch (Exception)
{
}
}
return item.ToString();
}
示例8: FromPhysicalVariant
public static CSPlaneID FromPhysicalVariant(int perpendicularAxisNumber, AltaxoVariant physicalValue)
{
if (!(physicalValue == physicalValue))
throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValue.ToString());
CSPlaneID id = new CSPlaneID();
id._perpendicularAxisNumber = perpendicularAxisNumber;
id._physicalValue = physicalValue;
id._logicalValue = double.NaN;
id._usePhysicalValue = true;
return id;
}
示例9: FromPhysicalVariant
public static CSPlaneID FromPhysicalVariant(int perpendicularAxisNumber, AltaxoVariant physicalValue)
{
#pragma warning disable CS1718 // Comparison made to same variable
if (!(physicalValue == physicalValue))
throw new ArgumentException("You can not set physical values that return false when compared to itself, value is: " + physicalValue.ToString());
#pragma warning restore CS1718 // Comparison made to same variable
return new CSPlaneID(perpendicularAxisNumber, double.NaN, true, physicalValue);
}