- - PR -
キャストについて
1
投稿者 | 投稿内容 |
---|---|
|
投稿日時: 2004-09-13 11:45
初めての書き込みですが、わからないことがあり、よろしければご教授下さい。
using System; namespace Sample007 { class Class1 { [STAThread] static void Main( string[] args ) { string str = "0" ; int[] it = new int[ 3 ] ; it[ 0 ] = 15 ; Console.WriteLine( it[ str ] ) ; } } } これが実行できるようなキャストの方法を、ご存知の方がいましたら教えてもらえませんか。 |
|
投稿日時: 2004-09-13 11:54
文字列を数字にできない、という問題の解決法でいいですかね?
http://homepage3.nifty.com/dotnetfan/console/console04.html キャストではなく、Int32.Parseを使えばよいかと。 |
|
投稿日時: 2004-09-13 13:49
ありがとうございます。
このサイトの方法で完璧に動作しました。本当に助かりました。 |
1