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
Frank Galavan
NA
9
14.7k
How do I pass a object class to a DLL?
Jul 17 2014 8:26 AM
I am running Windows 7 Enterprise 64bit and Visual Studio 2012. The Program and the DLL Library and the class are all .NET 4.0.
As it started out the program had Dictionaries to contain the files found in a specific directory. Such as Dictionary myDictionary<string, int> where the string was the filename and the int value was the status.
I tried to pass this along to the DLL function. On the DLL side there didn't seem to be a problem but on the program side it said that I could not use the Dictionary as a Type definition.
The only solution I could come up with was to encapsulate the dictionaries within a public class and then send that class to the function as an object.
So my Process is:
Instantiate the new class. Example: Files myFiles = new Files();
Add all the files I am tracking to the Dictionaries within the myFiles class and set the default status of each file.
The DLL is Referenced within the project and then set with a "using" statement. It is also instantiated within the main project. Example: ValidateFiles myvalidation = new ValidateFiles();
In the DLL there is a function called public void ValidateFile(object MyFiles) {...} which will read every line and verify that it is correctly formated.
The question I have is how do I get the Object MyFiles to see the Public methods and variables within the class I created and sent as an argument?
Reply
Answers (
0
)
access tabpages of tabcontrol in c#
editing in c# asp.net razor(mvc4)