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
deepa
NA
42
0
Collection properties should be readonly.
Aug 24 2009 7:59 AM
Hi,
According to FXCop, i must have arraylist property as read only (not setter).
i tried below method as was mentioned in msdn site(
http://msdn.microsoft.com/en-us/library/ms182327(VS.80).aspx
):
public ArrayList SomeStrings
{
get { return strings; }
// Violates the rule.
// set { strings = value; }
}
ArrayList newCollection = new ArrayList();
WritableCollection collection = new WritableCollection();
collection.SomeStrings = newCollection;
collection.SomeStrings.Clear();
collection.SomeStrings.AddRange(newCollection);
But at the point marked bold italic, i get error saying that the property is readonly.
I'm really stuck here, can anyone plz give m solution?
I need to set data to the arraylist, but its not FXCop compliant.
Reply
Answers (
0
)
How to save the image into the c drive of my pc capturing continuosly from a webcam using C# code
How to insert first blank row to binded ComboBox?