The String method is a member of the Library class. To use the method without creating an instance of the Library class make it a static method. Then, you can call it within the FillDataListView method -- Library.String(" ", 100)
Namespace problem

Dear All,
I create a function "String()" and put it into a separate file "library.cs" and assign the same "namespace NewTims" to it. However, if I paste it into the same page where the "String()" function resides, it works.
Library.cs
Error
1 additional answer
Sort by: Most helpful
-
Sreeju Nair 12,626 Reputation points
Mar 9, 2022, 11:11 AM String method you defined is a member function in the Library class. So you need to create the instance of Library class to call the String method.
Library lib = new Library(); lib.String(................);
Since the method you used is not dependent on any property of Library class, making it a static function will simplify the function call.
public static string String(.......) { }
Now you can clall this method as below.
Library.String(..........);