Share via


Comma7Io.new Method

Initializes a new instance of the Object class.

Syntax

public void new(str filename, str mode)

Run On

Called

Parameters

  • filename
    Type: str
  • mode
    Type: str

Remarks

If an attacker can control input to the new method, a security risk exists. Therefore, this method runs under Code Access Security. Calls to this method on the server require permission from the . Ensure that the user has development privileges by setting the security key to SysDevelopment on the control that calls this method.

Examples

This example uses the Comma7IO class to read from the ExampleFile file.

void Comma7IoExample() 
{ 
    Comma7Io io; 
    container con; 
    FileIoPermission perm; 
  
    #define.ExampleFile(@"c:\test.txt") 
    #define.ExampleOpenMode("r") 
  
    perm = new FileIoPermission(#ExampleFile, #ExampleOpenMode); 
    if (perm == null) 
    { 
        return; 
    } 
    // Grants permission to execute the Comma7Io.new method. 
    // Comma7Io.new runs under code access security. 
    perm.assert(); 
  
    io = new Comma7Io(#ExampleFile, #ExampleOpenMode); 
    if (io != null) 
    { 
        con = io.read(); 
    } 
    // Close the code access permission scope. 
    CodeAccessPermission::revertAssert(); 
}

See Also

Reference

Comma7Io Class