TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
325.8k
As casting
Jul 7 2013 7:23 PM
In this example following way casting is done.
string
value = list[i]
as string
;
Similar output is obtained with varied casting way
string
value = (
string
)list[i];
My question is whether casting is correct either way whatever data types are.
using System;
using System.Collections;
class Program
{
static void Main()
{
ArrayList list = new ArrayList();
list.Add("man");
list.Add("woman");
list.Add("plant");
for (int i = 0; i < list.Count; i++)
{
string
value = list[i]
as string
;
Console.WriteLine(value);
}
Console.ReadKey();
}
}
Reply
Answers (
4
)
how to get API data in windows form application?
Inheriting a sealed class