.NET Examples

Description

Xbasic examples for working with .NET objects in Alpha Anywhere.

Name
Description
DotNet Example: Big Integers

This sample demonstrates loading, registering and using a .NET class from a DLL in the standard location. It also demonstrates using a constructor to load a value into a .NET class when it is created.

DotNet Example: Complex Numbers

This sample demonstrates using a Class file, and also loading, registering and using a .NET class from a DLL in the standard location. It also demonstrates using a constructor to load a value into a .NET class when it is created.

DotNet Example: Digital Hash

Digital hash functions are often used to validate executable files and digital documents. One important use of a digital hash is to sign e-commerce documents; this is required in order to do business on Amazon, for example.

DotNet Example: Image metadata class

When writing an Xbasic function that uses the .NET Framework, you always have the option of writing or using a custom .NET class that gives you a simplified interface compared to using the .NET Framework classes directly. This example demonstrates extracting EXIF information from an image using the Exifacto .NET library.

DotNet Example: Matrix Manipulation

Mapack is a C# class library for basic linear algebra. It computes Norm, Determinant, Cholesky, LU, QR, SVD, least squares and eigenproblems. See Lutz Roeder's site, and download the source from here. You can compile it yourself from source, or [download the compiled DLL] to use with the example code below.

DotNet Example: Send an email

This example is an Xbasic script that sends an email using the .NET System::Net::Mail class. Copy this into a new Xbasic module or desktop script, fill in your parameters, and test it from your application.

DotNet Example: Serial IO

This is an interactive session that assumes there is a modem on port COM1: and dials the modem.

DotNet Example: Speech Synthesis

This sample demonstrates loading, registering and using a .NET class from a DLL in the standard location.

DotNet Example: Using a Private Assembly

Download and unzip the attached assembly, which corresponds to the C# source code in the first snippet. Paste the Xbasic code in the second snippet into an Alpha Anywhere script, edit the path to the location of the downloaded DLL, and run the script.

DotNet Example: Using System.Text.StringBuilder

The script below shows an interactive window session in which the .NET type System.Text.StringBuilder is mapped into the Xbasic type system.

DotNet Example: Working with Enumerated Types

.NET enumerated types appear to be of type P in Alpha Five. Using .NET enumerated types in Xbasic, for example System::Web::HttpCookieMode, will require attention to the coding style. It is best to assign and test enumerated types as follows:

DotNet Example: Working with Streams

Occasionally a .NET function will require that you pass or receive a stream as a parameter. This example shows how to create a stream to upload a file.

See Also