Dim ... AS ... New
The new class type being created.
The new class type being assigned. In most situations, classname1 and classname2 will be the same.
If you have a class type, such as SQL::Arguments, and you say dim args as new SQL::Arguments = new SQL::Arguments, then whatever was there to begin with will be overwritten with the brand new definition of SQL::Arguments.
dim args as SQL::Arguments args.set("MyArg","MyArgValue") new SQL::Arguments()
In some situations, the class of the variable you create is different from the assigned class. For example, in the code below, a variable named Stream is initially defined as a System::IO::Stream type. Later in the example, the Stream variable is assigned a new System::IO::MemoryStream object. The System::IO::MemoryStream is a type of System::IO::Stream class. Both classes are found in the .NET framework, which can be called into using Xbasic:
dim Stream as System::IO::Stream = null_value() dim ContentType as C dim Length as N dim Buffer as B dim CallResult as CallResult dim Container as A5Storage::DataContainer = null_value() Stream = new System::IO::MemoryStream() CallResult = A5Storage::DataContainer::Open(Container, "Provider='Disk';Container='c:\A5Webroot';") if CallResult.Success if Container.WriteItemToStream(Stream, Length, ContentType, "Speak.a5w") Stream.Seek(0, System::IO::SeekOrigin::Begin) dim Reader as System::IO::BinaryReader = new System::IO::BinaryReader(Stream) Buffer = Reader.ReadBytes(Length) Stream.close() else CallResult = Container.CallResult end if end if if CallResult.Success showvar("Type: " + ContentType + crlf() + "Length: " + Length + crlf(2) + buffer, "Success") else showvar(CallResult.Text, "Error") end if