What is wrong with this code please?

T

trint

using System;
using System.Text;
using System.Runtime.InteropServices;

[StructLayout( LayoutKind.Sequential)]
public struct DOCINFO
{
[MarshalAs(UnmanagedType.LPWStr)]public stringpDocName;
[MarshalAs(UnmanagedType.LPWStr)]public stringpOutputFile;
[MarshalAs(UnmanagedType.LPWStr)]public string pDataType;
}

on just these:
[MarshalAs(UnmanagedType.LPWStr)]public stringpDocName;
[MarshalAs(UnmanagedType.LPWStr)]public stringpOutputFile;

I get the error at compile:
"error CS1519: Invalid token ';' in class, struct, or interface member
declaration"
Thanks,
Trint
 
?

=?ISO-8859-1?Q?Anders_Nor=E5s?=

trint said:
[MarshalAs(UnmanagedType.LPWStr)]public stringpDocName;
[MarshalAs(UnmanagedType.LPWStr)]public stringpOutputFile;

I get the error at compile:
"error CS1519: Invalid token ';' in class, struct, or interface member
declaration"
There should be a space between string and "pDocName" and "pOutputFile".
[MarshalAs(UnmanagedType.LPWStr)]public string pDocName;
[MarshalAs(UnmanagedType.LPWStr)]public string pOutputFile;

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top