.resx record count ?

  • Thread starter Thread starter JezB
  • Start date Start date
J

JezB

I want to quickly get a count of the number of entries in a resource file
(.resx).
Using a ResXResourceReader and counting manually seems extremely slow.
Is there a quicker way ?
 
why?

just kidding, it doesn't matter,

here's an idea:

..resx is an xml file right?
you could use the System.xml.xmlDocument class to load the .resx
file, and then maybe something like this (VB.NET):

Dim x As New XmlDocument
x.Load(Application.StartupPath.ToString + "\Images.resx")
Dim nl As XmlNodeList = x.GetElementsByTagName("data")
Dim i As Integer = nl.Count

to get the number of <data> ... </data> elements in the file.

Whadaya think?
(i tested the above and it seems to work correctly...)
 
Cheers, I'll try it.

Brian G. DeKorte said:
why?

just kidding, it doesn't matter,

here's an idea:

.resx is an xml file right?
you could use the System.xml.xmlDocument class to load the .resx
file, and then maybe something like this (VB.NET):

Dim x As New XmlDocument
x.Load(Application.StartupPath.ToString + "\Images.resx")
Dim nl As XmlNodeList = x.GetElementsByTagName("data")
Dim i As Integer = nl.Count

to get the number of <data> ... </data> elements in the file.

Whadaya think?
(i tested the above and it seems to work correctly...)
 
Well, I found that I needed a full scan for another reason anyway, so I
didn't get round to trying your suggestion, but thanks all the same.
 
Back
Top