ok so i have a Class A that implements method M1 that takes an excel path and a sheet name, and returns an OledbDataReader .
Class B calls the method M1 , does some stuff with the OledbDataReader, then closes the OledbDataReader. but how can i Close The OLEDBConnection object? i dont have access to it because M1 in Class A opened the connection ! any ideas? thank youu
ok so i have a Class A that implements method M1 that takes an
Share
You can remodel your class A like this:
Then it’s the resposibility of the calling class to use your class like this: