本文整理汇总了C#中SerializationInfo.GetDateTime方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetDateTime方法的具体用法?C# SerializationInfo.GetDateTime怎么用?C# SerializationInfo.GetDateTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetDateTime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest
//.........这里部分代码省略.........
iCountTestcases++;
if(serinfo1.GetDouble(strValue)!= dblValue)
{
iCountErrors++;
Console.WriteLine("Err_653cfd_" + i + "! Wrong value returned, " + serinfo1.GetDouble(strValue));
}
}
Console.WriteLine("Single ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_0247fd_" + i;
sglValue = (float)(Single.MaxValue * rnd1.NextDouble());
if(rnd1.NextDouble()<0.5)
sglValue = (-1 * sglValue);
strValue = "Single_" + i;
serinfo1.AddValue(strValue, sglValue);
iCountTestcases++;
if(serinfo1.GetSingle(strValue)!= sglValue)
{
iCountErrors++;
Console.WriteLine("Err_0468fd_" + i + "! Wrong value returned, " + serinfo1.GetSingle(strValue));
}
}
strValue = "This is a String";
serinfo1.AddValue("String_1", strValue);
iCountTestcases++;
if(!serinfo1.GetString("String_1").Equals(strValue))
{
iCountErrors++;
Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_1"));
}
strValue = "";
serinfo1.AddValue("String_2", strValue);
iCountTestcases++;
if(!serinfo1.GetString("String_2").Equals(String.Empty))
{
iCountErrors++;
Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_2"));
}
strValue = null;
serinfo1.AddValue("String_3", strValue);
iCountTestcases++;
if(serinfo1.GetString("String_3") != null)
{
iCountErrors++;
Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetString("String_3"));
}
try {
iCountTestcases++;
serinfo1.AddValue("String_2", fValue);
iCountErrors++;
Console.WriteLine("Err_1065753cd! Exception not thrown");
}catch(SerializationException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_5739cd! Wrong exception thrown, " + ex);
}
Console.WriteLine("Single ticks, " + Environment.TickCount);
for(int i=0; i<50; i++) {
strLoc="Loc_0247fd_" + i;
dblValue = (double)(DateTime.MaxValue.ToOADate() * rnd1.NextDouble());
strValue = "DateTime_" + i;
dtValue = DateTime.FromOADate(dblValue);
serinfo1.AddValue(strValue, dtValue);
iCountTestcases++;
if(serinfo1.GetDateTime(strValue)!= dtValue)
{
iCountErrors++;
Console.WriteLine("Err_0468fd_" + i + "! Wrong value returned, " + serinfo1.GetDateTime(strValue));
}
}
for(int i=0; i<50; i++) {
strLoc="Loc_0247fd_" + i;
dcmValue = (Decimal)((double)Decimal.MaxValue * rnd1.NextDouble());
if(rnd1.NextDouble()<0.5)
dcmValue = (Decimal)(-1 * dcmValue);
strValue = "Decimal_" + i;
serinfo1.AddValue(strValue, dcmValue);
iCountTestcases++;
if(serinfo1.GetDecimal(strValue)!= dcmValue)
{
iCountErrors++;
Console.WriteLine("Err_2342fdsg_" + i + "! Wrong value returned, " + serinfo1.GetDecimal(strValue));
}
}
} while (false);
} catch (Exception exc_general ) {
++iCountErrors;
Console.WriteLine (s_strTFAbbrev + " : Error Err_8888yyy! strLoc=="+ strLoc +", exc_general==\n"+exc_general.StackTrace);
}
if ( iCountErrors == 0 )
{
Console.WriteLine( "paSs. "+s_strTFPath +" "+s_strTFName+" ,iCountTestcases=="+iCountTestcases.ToString());
return true;
}
else
{
Console.WriteLine("FAiL! "+s_strTFPath+" "+s_strTFName+" ,iCountErrors=="+iCountErrors.ToString()+" , BugNums?: "+s_strActiveBugNums );
return false;
}
}
示例2: LoggingEvent
protected LoggingEvent (SerializationInfo info, StreamingContext context)
{
_message = info.GetString ("Message");
_timeStamp = info.GetDateTime ("TimeStamp");
}