473,387 Members | 1,495 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

why its go to get - insted of sets?

hello:
i got a wierd case:
i am trying to add an item to the list but i am facing a problem:

Expand|Select|Wrap|Line Numbers
  1. public partial class test: System.Web.UI.Page
  2. {
  3.     protected void Page_Load(object sender, EventArgs e)
  4.     {
  5.         MyProperty.Add(1); <----- why here its go to get - insted of sets?
  6.         int i = MyProperty[0];
  7.     }
  8.     private List<int> myVar = new List<int>();
  9.  
  10.     public List<int> MyProperty
  11.     {
  12.         get { return myVar; }
  13.         set { myVar = value; }
  14.     }
  15.  
  16. }
  17.  
thanks
Aug 30 '08 #1
2 851
Curtis Rutland
3,256 Expert 2GB
OK, there are a few things wrong with your post here. Please use [code] tags. Also, you need to actually ask a question. Explain your goal clearly, and the problems you are having achieving this goal.

Please correct these problems in a reply to this thread.

Please read our Posting Guidelines before you make another post.

MODERATOR
Aug 30 '08 #2
vekipeki
229 Expert 100+
Expand|Select|Wrap|Line Numbers
  1. public partial class test: System.Web.UI.Page
  2. {
  3.     protected void Page_Load(object sender, EventArgs e)
  4.     {
  5.         MyProperty.Add(1); <----- why here its go to get - insted of sets?
  6.         int i = MyProperty[0];
  7.     }
  8.     private List<int> myVar = new List<int>();
  9.  
  10.     public List<int> MyProperty
  11.     {
  12.         get { return myVar; }
  13.         set { myVar = value; }
  14.     }
  15.  
  16. }
  17.  
Your code is getting your property because you are not actually setting it to a new value - you are accessing your existing list's Add() method. If you were to write this:

Expand|Select|Wrap|Line Numbers
  1. this.MyProperty = new List<int>();
then you would be actually setting your property to a new value.
Sep 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: Raymond Hettinger | last post by:
I've gotten lots of feedback on the itertools module but have not heard a peep about the new sets module. * Are you overjoyed/outraged by the choice of | and & as set operators (instead of + and...
5
by: Raymond Hettinger | last post by:
For Py2.4, I'm working on a C implementation of Sets.py with the possibility of having a set() type as a builtin. There is a question as whether the current design for set of sets has been useful....
7
by: Steve | last post by:
This post has two parts. First is my feedback on sets. (Hello? Last summer called, they want their discussion thread back...) Second is some questions about my implementation of a partition...
1
by: Schultz | last post by:
Hi, I would like to be able to edit data in a datagrid by column insted of by row. Is this possible? And, how can one make an entire Datagrid editable by clicking on "Edit All" > "Update" or...
2
by: mkppk | last post by:
I have kind of strange change I'd like to make to the sets.Set() intersection() method.. Normally, intersection would return items in both s1 and s2 like with something like this: ...
11
by: Prateek | last post by:
I have 3 variable length lists of sets. I need to find the common elements in each list (across sets) really really quickly. Here is some sample code: # Doesn't make sense to union the sets -...
2
by: hdf | last post by:
hi could you hlp me with this each time i draw reports from my sql database it display the following charaters don’t insted of the don't and you hlpme with this. it hpens every time some one...
4
seshu
by: seshu | last post by:
Hi everybody Presently Iam write three select statements with diff where and limt conditions but the select stmt in them is same insted of that can i write only one direct stmt...
1
by: JosAH | last post by:
Greetings, Introduction This week I'll write a bit about generics (those funny angular brackets). I need an example and decided to use sets and some of their operations. This weeks' article...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.