本文整理汇总了C#中SerializationInfo.GetChar方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetChar方法的具体用法?C# SerializationInfo.GetChar怎么用?C# SerializationInfo.GetChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetChar方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: runTest
public bool runTest()
{
Console.WriteLine(s_strTFPath + " " + s_strTFName + " , for " + s_strClassMethod + " , Source ver : " + s_strDtTmVer);
int iCountErrors = 0;
int iCountTestcases = 0;
String strLoc = "Loc_000oo";
SerializationInfo serinfo1 = null;
Boolean fValue;
Char chValue;
SByte sbtValue;
Byte btValue;
Int16 i16Value;
Int32 i32Value;
Int64 i64Value;
UInt16 ui16Value;
UInt32 ui32Value;
UInt64 ui64Value;
Double dblValue;
Single sglValue;
DateTime dtValue;
Decimal dcmValue;
StringBuilder sbldr1;
String strValue;
Random rnd1;
try {
do
{
strLoc="Loc_6573cd";
serinfo1 = new SerializationInfo(typeof(Int32), new FormatterConverter());
iCountTestcases++;
if(serinfo1.MemberCount != 0)
{
iCountErrors++;
Console.WriteLine("Err_0246sd! Wrong number of members, " + serinfo1.MemberCount.ToString());
}
strLoc="Loc_6853vd";
fValue = false;
serinfo1.AddValue("Boolean_1", fValue);
iCountTestcases++;
if(serinfo1.GetBoolean("Boolean_1") != fValue)
{
iCountErrors++;
Console.WriteLine("Err_0945csd! wrong value returned, " + serinfo1.GetBoolean("Boolean_1"));
}
fValue = true;
serinfo1.AddValue("Boolean_2", fValue);
iCountTestcases++;
if(serinfo1.GetBoolean("Boolean_2") != fValue)
{
iCountErrors++;
Console.WriteLine("Err_6753vd! wrong value returned, " + serinfo1.GetBoolean("Boolean_2"));
}
try {
iCountTestcases++;
serinfo1.AddValue("Boolean_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("Large String, ticks, " + Environment.TickCount);
sbldr1 = new StringBuilder("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
fValue = false;
serinfo1.AddValue(sbldr1.ToString(), fValue);
iCountTestcases++;
if(serinfo1.GetBoolean(sbldr1.ToString()) != fValue)
{
iCountErrors++;
Console.WriteLine("Err_6538fvd! wrong value returned, " + serinfo1.GetBoolean(sbldr1.ToString()));
}
try {
iCountTestcases++;
serinfo1.AddValue(null, fValue);
iCountErrors++;
Console.WriteLine("Err_0156ds! Exception not thrown");
}catch(ArgumentNullException){
}catch(Exception ex){
iCountErrors++;
Console.WriteLine("Err_57834fd! Wrong exception thrown, " + ex);
}
Console.WriteLine("Char ticks, " + Environment.TickCount);
rnd1 = new Random();
for(int i=0; i<50; i++) {
strLoc="Loc_6753cd_" + i;
chValue = (Char)(65536 * rnd1.NextDouble());
strValue = "Char_" + i;
serinfo1.AddValue(strValue, chValue);
iCountTestcases++;
if(serinfo1.GetChar(strValue)!= chValue)
{
iCountErrors++;
Console.WriteLine("Err_65730dsw_" + i + "! Wrong Char returned, " + serinfo1.GetChar(strValue));
}
}
try {
iCountTestcases++;
serinfo1.AddValue("Char_1", 'a');
iCountErrors++;
//.........这里部分代码省略.........