Get the name of the file...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a class. How could i obtain the name of the file of this class (for
example, if my class name is test, the name of the file is test.cs)
 
Josema said:
Hi,

I have a class. How could i obtain the name of the file of this class (for
example, if my class name is test, the name of the file is test.cs)

What is your question? You seem to have given
the answer yourself.
 
If you have a class name, use

typeof(Test).Assembly.Location

If you have a variable, use

myTest.GetType().Assembly.Location
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top