CSharpTest.Net
FileVersion Enumeration
Example  See Also  Send Feedback Download Help File
CSharpTest.Net.BPlusTree Assembly > CSharpTest.Net.Collections Namespace : FileVersion Enumeration

Glossary Item Box

Determines the binary file format and backwards compatibility

Syntax

Visual Basic (Declaration) 
Public Enum FileVersion 
   Inherits System.Enum
C# 
public enum FileVersion : System.Enum 

Members

MemberDescription
Version1Version 1 compatable
Version2Version 2 compatable

Example

BPlusTree/BPlusTree.Test/SampleCustomTypeTest.cs

C#Copy Code
BPlusTree<KeyInfo, DataValue>.Options options =
    new BPlusTree<KeyInfo, DataValue>.Options(new KeyInfoSerializer(), new DataValueSerializer(), new KeyInfoComparer());
options.CalcBTreeOrder(32, 300);//we can simply just guess close
options.FileName = TempFile.TempPath;
options.CreateFile = CreatePolicy.Always;//obviously this is just for testing
Assert.AreEqual(FileVersion.Version1, options.FileVersion);

Random rand = new Random();
KeyInfo k1 = new KeyInfo(), k2 = new KeyInfo();

using (BPlusTree<KeyInfo, DataValue> tree = new BPlusTree<KeyInfo, DataValue>(options))
{
    byte[] data = new byte[255];

    rand.NextBytes(data);
    tree.Add(k1, new DataValue(k1, data));

    Assert.IsTrue(tree.ContainsKey(k1));
    Assert.IsFalse(tree.ContainsKey(k1.Next()));
    Assert.AreEqual(data, tree[k1].Bytes);

    rand.NextBytes(data);
    tree.Add(k2, new DataValue(k2, data));

    Assert.IsTrue(tree.ContainsKey(k2));
    Assert.IsFalse(tree.ContainsKey(k2.Next()));
    Assert.AreEqual(data, tree[k2].Bytes);
}
options.CreateFile = CreatePolicy.Never;
using (BPlusTree<KeyInfo, DataValue> tree = new BPlusTree<KeyInfo, DataValue>(options))
{
    Assert.IsTrue(tree.ContainsKey(k1));
    Assert.IsTrue(tree.ContainsKey(k2));
}
VB.NETCopy Code
Dim options As New BPlusTree(Of KeyInfo, DataValue).Options(New KeyInfoSerializer(), New DataValueSerializer(), New KeyInfoComparer())
options.CalcBTreeOrder(32, 300)
'we can simply just guess close
options.FileName = TempFile.TempPath
options.CreateFile = CreatePolicy.Always
'obviously this is just for testing
Assert.AreEqual(FileVersion.Version1, options.FileVersion)

Dim rand As New Random()
Dim k1 As New KeyInfo(), k2 As New KeyInfo()

Using tree As New BPlusTree(Of KeyInfo, DataValue)(options)
    Dim data As Byte() = New Byte(255) {}

    rand.NextBytes(data)
    tree.Add(k1, New DataValue(k1, data))

    Assert.IsTrue(tree.ContainsKey(k1))
    Assert.IsFalse(tree.ContainsKey(k1.[Next]()))
    Assert.AreEqual(data, tree(k1).Bytes)

    rand.NextBytes(data)
    tree.Add(k2, New DataValue(k2, data))

    Assert.IsTrue(tree.ContainsKey(k2))
    Assert.IsFalse(tree.ContainsKey(k2.[Next]()))
    Assert.AreEqual(data, tree(k2).Bytes)
End Using
options.CreateFile = CreatePolicy.Never
Using tree As New BPlusTree(Of KeyInfo, DataValue)(options)
    Assert.IsTrue(tree.ContainsKey(k1))
    Assert.IsTrue(tree.ContainsKey(k2))
End Using

Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         CSharpTest.Net.Collections.FileVersion

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys