本文整理汇总了C#中Db4objects.Db4o.Reflect.ArrayInfo.ElementCount方法的典型用法代码示例。如果您正苦于以下问题:C# ArrayInfo.ElementCount方法的具体用法?C# ArrayInfo.ElementCount怎么用?C# ArrayInfo.ElementCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Reflect.ArrayInfo
的用法示例。
在下文中一共展示了ArrayInfo.ElementCount方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewInstance
public virtual object NewInstance(IReflectClass componentType, ArrayInfo info)
{
componentType = componentType.GetDelegate();
if (componentType is GenericClass)
{
int length = info.ElementCount();
return new GenericArray(((GenericClass)componentType).ArrayClass(), length);
}
return _delegate.NewInstance(componentType, info);
}
示例2: ReadDimensions
private void ReadDimensions(ArrayInfo info, IReadBuffer buffer, int dimensionCount
)
{
var dim = new int[dimensionCount];
for (var i = 0; i < dim.Length; i++)
{
dim[i] = buffer.ReadInt();
}
((MultidimensionalArrayInfo) info).Dimensions(dim);
info.ElementCount(ElementCount(dim));
}
示例3: ReadElements
protected override void ReadElements(IReadContext context, ArrayInfo info, object
array)
{
if (array == null)
{
return;
}
object[] objects = new object[info.ElementCount()];
ReadInto(context, info, objects);
ArrayReflector(Container(context)).Shape(objects, 0, array, ((MultidimensionalArrayInfo
)info).Dimensions(), 0);
}
示例4: NewInstance
public virtual object NewInstance(IReflectClass componentType, ArrayInfo info)
{
// TODO: implement multidimensional arrays.
int length = info.ElementCount();
return NewInstance(componentType, length);
}
示例5: AnalyzeDimensions
protected virtual void AnalyzeDimensions(ObjectContainerBase container, object obj
, ArrayInfo info)
{
info.ElementCount(ArrayReflector(container).GetLength(obj));
}
示例6: WriteDimensions
protected virtual void WriteDimensions(IWriteContext context, ArrayInfo info)
{
context.WriteInt(info.ElementCount());
}
示例7: WriteElements
protected virtual void WriteElements(IWriteContext context, object obj, ArrayInfo
info)
{
if (HandleAsByteArray(obj))
{
context.WriteBytes((byte[])obj);
}
else
{
// byte[] performance optimisation
if (HasNullBitmap(info))
{
BitMap4 nullItems = NullItemsMap(ArrayReflector(Container(context)), obj);
WriteNullBitmap(context, nullItems);
for (int i = 0; i < info.ElementCount(); i++)
{
if (!nullItems.IsTrue(i))
{
context.WriteObject(_handler, ArrayReflector(Container(context)).Get(obj, i));
}
}
}
else
{
for (int i = 0; i < info.ElementCount(); i++)
{
context.WriteObject(_handler, ArrayReflector(Container(context)).Get(obj, i));
}
}
}
}
示例8: ReadInto
protected void ReadInto(IReadContext context, ArrayInfo info, object array)
{
if (array == null)
{
return;
}
if (HandleAsByteArray(array))
{
context.ReadBytes((byte[])array);
// byte[] performance optimisation
return;
}
if (HasNullBitmap(info))
{
BitMap4 nullBitMap = ReadNullBitmap(context, info.ElementCount());
for (int i = 0; i < info.ElementCount(); i++)
{
object obj = nullBitMap.IsTrue(i) ? null : context.ReadObject(_handler);
ArrayReflector(Container(context)).Set(array, i, obj);
}
}
else
{
for (int i = 0; i < info.ElementCount(); i++)
{
ArrayReflector(Container(context)).Set(array, i, context.ReadObject(_handler));
}
}
}
示例9: ReadDimensions
protected virtual void ReadDimensions(ArrayInfo info, IReadBuffer buffer)
{
info.ElementCount(buffer.ReadInt());
}
示例10: ReadInfo
protected virtual void ReadInfo(Transaction trans, IReadBuffer buffer, ArrayInfo
info)
{
int classID = buffer.ReadInt();
if (IsPreVersion0Format(classID))
{
throw new UnsupportedOldFormatException();
}
else
{
_versionHelper.ReadTypeInfo(trans, buffer, info, classID);
ReflectClassFromElementsEntry(Container(trans), info, classID);
ReadDimensions(info, buffer);
}
if (Debug4.ExceedsMaximumArrayEntries(info.ElementCount(), _usePrimitiveClassReflector
))
{
info.ElementCount(0);
}
}
示例11: ReducedCountForNullBitMap
private int ReducedCountForNullBitMap(ArrayInfo info, IReadBuffer context)
{
if (!HasNullBitmap(info))
{
return 0;
}
return ReducedCountForNullBitMap(info.ElementCount(), ReadNullBitmap(context, info
.ElementCount()));
}
示例12: AnalyzeDimensions
protected override void AnalyzeDimensions(ObjectContainerBase container, object obj
, ArrayInfo info)
{
var dim = ArrayReflector(container).Dimensions(obj);
((MultidimensionalArrayInfo) info).Dimensions(dim);
info.ElementCount(ElementCount(dim));
}
示例13: WriteElements
protected override void WriteElements(IWriteContext context, object obj, ArrayInfo
info)
{
var objects = AllElements(Container(context), obj);
if (HasNullBitmap(info))
{
var nullBitMap = new BitMap4(info.ElementCount());
var nullBitMapBuffer = context.Reserve(nullBitMap.MarshalledLength());
var currentElement = 0;
while (objects.MoveNext())
{
var current = objects.Current;
if (current == null)
{
nullBitMap.SetTrue(currentElement);
}
else
{
context.WriteObject(DelegateTypeHandler(), current);
}
currentElement++;
}
nullBitMapBuffer.WriteBytes(nullBitMap.Bytes());
}
else
{
while (objects.MoveNext())
{
context.WriteObject(DelegateTypeHandler(), objects.Current);
}
}
}