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
dhivya N
NA
2
543
Generic Arrays- how to get data from user
Dec 8 2017 12:27 AM
How to take input from user for generic arrays?
class MyGenericArray<T>
{
T[] arr;
public MyGenericArray(int size)
{
T[] arr = new T[(size)];
Console.WriteLine("Pls enter {0} no of values", size);
for (int i = 0; i < size; i++)
{
arr[i] = Console.ReadLine() < T >; //am getting error here when i use convert.toint32(console.readline();-error states that generic cannot be converted to int.
}
}
Reply
Answers (
1
)
Ensure Security for Code
bar chart not displaying