Dumbfounded Getting Contents of Array UpperBound

  • Thread starter Thread starter clintonG
  • Start date Start date
C

clintonG

I'm trying to get the file name returned in a server variable and am really
feeling dumb because I haven't figured out how to use the available
methods correctly to get the contents of the array that exists in the upper
bound dimension. Can somebody finish it for me and not let anybody
know I asked? ;-)

string url = Request.ServerVariables["url"];
string [] split = url.Split('/');

// Returns
/Learn.NET/CS/PostBackEvents/UsingLinkButton.aspx
 
Hi clintonG,

If I understand you correctly, you want to read the last entry in the string array list ?

string filename = split[split.Length - 1];

GetUpperBound is mostly used for multidimensional arrays

string filename = split[split.GetUpperBound(0)]; // first dimension
 

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