TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
net generator
NA
6
2.2k
FileSystem.FilePutObject Alternative
Jun 15 2018 3:36 AM
Hi
I converted vb6 code into C# but facing an error.
Suppose we have Person
--------------------------------------------
public class Person
{
private int intID;
private string strName;
private string strSurname;
public Person()
{
intID = -1;
strName = "";
strSurname = "";
}
public int ID
{
get
{
return intID;
}
set
{
intID = value;
}
}
public string Name
{
get
{
return strName;
}
set
{
strName = value;
}
}
public string Surname
{
get
{
return strSurname;
}
set
{
strSurname = value;
}
}
}
--------------------------------------------------------------------
I want to write this class into file. I was using
Person entP = new Person();
entP.ID = 1;
entP.Name= "john";
entP.Surname ="doe";
FileSystem.FileOpen(1, "test_file", OpenMode.Binary);
FileSystem.FilePutObject(1, entP,-1);
FileSystem.FileClose(1);
But it throws an error
Unhandled Exception: System.ArgumentException: File I/O with type 'Person' is not valid.
It seems FilePutObject does not support classes. Is there alternative way to do same task?
Please guide
thanks
Reply
Answers (
0
)
I have doubt in download a text file
JavaScript runtime error