[Mono-list] Newbie trying to read an XML

yoros@wanadoo.es yoros@wanadoo.es
Sun, 16 Feb 2003 08:34:07 +0100


On Sun, Feb 16, 2003 at 01:26:15AM -0300, Santiago Erquicia wrote:
> Hello,
> 
> I am really newbie with C#.  I have only a little experience with java and web 
> development.
> 
> I am trying to read an XML and get the attributes from the nodes.  I reached 
> the point where I can do that.
> 
> My problem is that one of the attributes is the id of a transaction (which is 
> an int) and all the returned values from the attributes come as string.  How 
> can I change them?
> 
> Thanks and apologies if this is too stupid.

You can use Parse static method for convert a string to a "numeric"
value. For example:

    string s = "123";
    int i = Int32.Parse(s);

Now you got an integer.

Another class you can use is "Convert" that has methods to convert from
any of the primitive types to another...

    string s = "123";
    int i = Convert.ToInt32(s);

That's all.

Regards,

    Pedro

-- 
Pedro Martinez Juliá
\  yoros@terra.es
)|    yoros@wanadoo.es
/        http://yoros.cjb.net
Socio HispaLinux #311
Usuario Linux #275438 - http://counter.li.org
GnuPG public information:  pub  1024D/74F1D3AC
Key fingerprint = 8431 7B47 D2B4 5A46 5F8E  534F 588B E285 74F1 D3AC