本文整理汇总了C#中SerializationReader.ReadOptimizedString方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationReader.ReadOptimizedString方法的具体用法?C# SerializationReader.ReadOptimizedString怎么用?C# SerializationReader.ReadOptimizedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerializationReader
的用法示例。
在下文中一共展示了SerializationReader.ReadOptimizedString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializeStateBag
public static StateBag DeserializeStateBag(SerializationReader reader)
{
var flags = reader.ReadOptimizedBitVector32();
var stateBag = new StateBag(flags[StateBagIsIgnoreCase]);
if (flags[StateBagHasDirtyEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
// ReSharper disable PossibleNullReferenceException
stateBag.Add(key, value).IsDirty = true;
// ReSharper restore PossibleNullReferenceException
}
}
if (flags[StateBagHasCleanEntries])
{
var count = reader.ReadOptimizedInt32();
for(var i = 0; i < count; i++)
{
var key = reader.ReadOptimizedString();
var value = reader.ReadObject();
stateBag.Add(key, value);
}
}
return stateBag;
}
示例2: DeserializeColor
public static Color DeserializeColor(SerializationReader reader)
{
var flags = reader.ReadOptimizedBitVector32();
if (flags[ColorIsKnown]) return Color.FromKnownColor((KnownColor) reader.ReadOptimizedInt32());
if (flags[ColorHasName]) return Color.FromName(reader.ReadOptimizedString());
if (!flags[ColorHasValue]) return Color.Empty;
var red = flags[ColorHasRed] ? reader.ReadByte() : (byte) 0;
var green = flags[ColorHasGreen] ? reader.ReadByte() : (byte) 0;
var blue = flags[ColorHasBlue] ? reader.ReadByte() : (byte) 0;
var alpha = flags[ColorHasAlpha] ? reader.ReadByte() : (byte) 0;
return Color.FromArgb(alpha, red, green, blue);
}
示例3: DeserializeStateBag
public static StateBag DeserializeStateBag(SerializationReader reader)
{
BitVector32 flags = reader.ReadOptimizedBitVector32();
StateBag stateBag = new StateBag(flags[StateBagIsIgnoreCase]);
if (flags[StateBagHasDirtyEntries])
{
int count = reader.ReadOptimizedInt32();
for(int i = 0; i < count; i++)
{
string key = reader.ReadOptimizedString();
object value = reader.ReadObject();
stateBag.Add(key, value).IsDirty = true;
}
}
if (flags[StateBagHasCleanEntries])
{
int count = reader.ReadOptimizedInt32();
for(int i = 0; i < count; i++)
{
string key = reader.ReadOptimizedString();
object value = reader.ReadObject();
stateBag.Add(key, value);
}
}
return stateBag;
}
示例4: DeserializeDataSet
public DataSet DeserializeDataSet(DataSet dataSet, byte[] serializedData)
{
this.dataSet = dataSet;
reader = new SerializationReader(serializedData);
dataSet.EnforceConstraints = false;
BitVector32 flags = reader.ReadOptimizedBitVector32();
if (flags[DataSetHasName]) dataSet.DataSetName = reader.ReadOptimizedString();
dataSet.Locale = new CultureInfo(reader.ReadOptimizedInt32());
dataSet.CaseSensitive = flags[DataSetIsCaseSensitive];
if (flags[DataSetHasNamespace]) dataSet.Namespace = reader.ReadOptimizedString();
if (flags[DataSetHasPrefix]) dataSet.Prefix = reader.ReadOptimizedString();
if (flags[DataSetHasTables]) deserializeTables();
if (flags[DataSetHasForeignKeyConstraints]) deserializeForeignKeyConstraints();
if (flags[DataSetHasRelationships]) deserializeRelationships();
if (flags[DataSetHasExtendedProperties]) deserializeExtendedProperties(dataSet.ExtendedProperties);
dataSet.EnforceConstraints = flags[DataSetAreConstraintsEnabled];
throwIfRemainingBytes();
return dataSet;
}