I am trying to change a class that I got from an open source library. While I was referencing the library in my project, the source class contained references to parts of the library marked internal . This causes build errors in my code.
I read this answer: How do you "override" the inner class in C #? . Note that this indicates that you are out of luck when you want to access the internal class if you do not have access to the source code. This, however, is not for me.
I can fix it, but I want to know if there is a good way to do this. It seems to me that I have two options. I could change the source code for the internal class so that it is not internal (bad), or I could import the class itself directly into my project (worse). If I import a class, there are additional problems with the link, and I will probably have to import the whole library to fix the dependencies.
Please note that I know that I could add my change to the open source library and then create it as a new library for reference in my code. I do not want to do this at this time, because I would like to be able to enter my method in the debugger. As soon as I debug my method and guarantee its usefulness, I will make it available as part of my open source version of the project.
I am new to C # and this is my first experience working on a large open source project, so I would like to advise how to deal with this problem.
Update:
Here is the link to the source code of the library that I would like to change: https://github.com/accord-net/framework/blob/development/Sources/Accord.Math/Optimization/Unconstrained/Least%20Squares/LevenbergMarquardt.cs
To change this code, I opened the source in visual studio and tried to create a version of how it currently exists. Line 304 displays the following code:
int[] block = Vector.Range(s * blockSize, s * blockSize + B); .
When I have this file in visual studio, it gives me a message that Vector not available due to its level of protection. When I look at the definition of this code in an intellisense window, it shows that Vector marked as internal .
If I try to bring Vector source code into my project, more than one type is released, because Vector uses other internal classes.