I have the following code
public class IDFMeasure
{
,,,,,,,,,,
........
public float [][] GetIDFMeasure(string[] documents)
{
_docs = documents;
_numDocs = documents.Length;
MyInit();
return _termWeight;
}
}
I want to call this class in the main program. How I do it ? I'm getting confused with class types.. Can any help please? Many thanks
You don't call a class. You instantiate a class and call its methods. You can do so like this:
public void main() {
IDFMeasure measure = new IDFMeasure(); // instantiate class
float[][] vals = measure.GetIDFMeasure(documents); // now call method on that class
}
Create object of class and then call the method.
IDFMeasure obj = new IDFMeasure ();
float [][] arr = obj.GetIDFMeasure(new string[]{"1"});
If you only need to call the method and do not need object any more then you can create anonymous object and call method on it.
float [][] arr = new IDFMeasure().GetIDFMeasure(new string[]{"1"});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.