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
Ert Tre
NA
3
553
Colletion To List
Jul 23 2016 3:11 AM
Hello Forum,
I have a collection class (inherited from System.Collections.CollectionBase). I want to return the contents in a list<>. I do this with the following function:
public List<MyCustomBlock> Clone()
{
List<MyCustomBlock> objMyCustomBlockList = new List<MyCustomBlock>();
MyCustomBlock[] objMyCustomBlockArray= new MyCustomBlock[this.List.Count];
this.List.CopyTo(objMyCustomBlockArray, 0);
objMyCustomBlockList.AddRange(objMyCustomBlockArray);
return objMyCustomBlockList;
}
Is there a faster way of doing this (performance)?
Is there a more elegant way of writing this code (less code)?
Thank you.
Reply
Answers (
3
)
Rich Text Box overlay property?
Convert or read text from Image to string in C#.