user2163048
user2163048

Reputation: 23

Unable to run Console Application in c#

My friend gave me an .exe file for Console Application. By some trial software, I got the code for the file. The name of the folder is ConsoleApplication2. I made files and pasted it in under it.

Now when I try to debug , I get the errors like

..System.Data.DataRow
'System.Data.DataRow.ItemArray.get': cannot explicitly call operator or accessor
'System.Data.DataRow.this[int].get': cannot explicitly call operator or accessor    
'System.Data.DataRowCollection.this[int].get': cannot explicitly call operator or accessor

for many many lines.

 table2.Rows.Add(row.get_ItemArray());
 if (table2.Rows.get_Count() != 0)

This are two example of lines. I think this lines are proper. I have just made some mistake like copied code under wrong category. Forgot to change anything ???

please can u help me out.

Upvotes: 0

Views: 370

Answers (3)

Fernando Callejon
Fernando Callejon

Reputation: 149

Is that your code or did you got it from some decompiler?

get_ItemArray is a method generated by the compiler....

try removing get_ and set_


You can "Save code" using ILSpy (http://sourceforge.net/projects/sharpdevelop/files/ILSpy/2.0/ILSpy_Master_2.1.0.1603_RTW_Binaries.zip/download)

Select the assembly and click on "File->Save Code" that will export it to a project.

But, why you can't get the source code? Is it your code? is it a product you are trying not to pay for customization?

Upvotes: 3

Jeremy Thompson
Jeremy Thompson

Reputation: 65534

I dont have the original code. I had the exe, i got it from a decompiler. 

Download Reflector from RedGate and install Denis Bauer's File Dissasembler plugin.

Load the EXE into Reflector > Click the File Dissasemlber button to decompile the EXE back to a Solution with Project(s) and source files.

Upvotes: 1

Michael Petrotta
Michael Petrotta

Reputation: 60902

You are attempting to read the value of a property using its "hidden" accessor method. That's not allowed. You should instead reference the property value like this:

table2.Rows.Add(row.ItemArray);
if (table2.Rows.Count != 0)

Upvotes: 5

Related Questions