X++, C# Comparison: Classes about File IO

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

Microsoft Dynamics AX provides several classes that perform file input and output (IO) operations. In the .NET Framework that is used in C#, the counterparts to these classes reside in the System.IO namespace.

Table of Class Comparisons

The following table lists several .NET Framework classes for C# that are in the System.IO namespace. Each row in the table shows the X++ class or method that best corresponds to the .NET Framework class.

X++

C#

Comments

BinaryIo

FileStream

BinaryReader

BinaryWriter

X++ classes such as BinaryIo that extend from the abstract class Io serve as a stream, and they also serve as a reader and writer for that stream.

In C# the stream is a separate class the from the class that has the more specific read and write methods.

TextBuffer

MemoryStream

These classes contain an in-memory buffer, and some of the methods treat the buffer as if it were a file on the hard disk.

WINAPI::createDirectory

WINAPI::folderExists

WINAPI::removeDirectory

Directory

DirectoryInfo

Path

X++ can use static methods in the WINAPI class for many basic operating system functions that involve directories.

WINAPI::getDriveType

DriveInfo

DriveType

These classes and methods are used to obtain drive related information.

WINAPI::copyFile

WINAPI::createFile

WINAPI::deleteFile

WINAPI::fileExists

File

FileAttributes

FileInfo

X++ can use static methods in the WINAPI class for many basic operating system functions that involve files.

CommaIo

Comma7Io

(No corresponding class.)

These X++ classes can generate files that Microsoft Excel can import. In X++ the SysExcel Class provides additional interaction with Excel.

AsciiIo

TextIo

FileStream

TextReader

TextWriter

These classes use different code pages.

Io

Stream

StreamReader

StreamWriter

FileStream

These are often used as base classes that other classes extend.

CodeAccessPermission

FileIoPermission

System.Security

.CodeAccessPermission

The namespace System.Security.Permissions includes the following classes:

  • CodeAccessSecurityAttribute

  • FileIOPermissionAttribute

  • FileIOPermission

  • FileIOPermissionAccess

The concepts and methods of assert, demand, and revertAssert apply to both languages. However, the deny and revertDeny methods that are available in C# are not available in X++.

See also

X++, C# Comparison: Classes

Performing File IO with the TextIo Class

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.