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
Chris
NA
2
4.3k
Newbie Question: When does C# set values with "=" and when does it pass arguments to methods?
Oct 28 2010 5:43 AM
As a newbie to C# I'm using a couple of teach-yourself books. I have previously programmed in VHDL (!), tcl and unix scripts (and Pascal, asslembly but in the Stone Age).
I'm fine with understanding lines of code and the examples in my books but when I mess around on my own it all goes wrong. I can't seem to grasp the philosophy or design principles of the language when I want to assign values to variables and constants or set them to the values of other variables and constants.
It seems you can set numbers using maths a = fred * 3; and a few other things but in other cases you can't.
For instance it seems you can define a new array = new int[3] {1, 2, 3} but you can't set an array by going arr = {1, 2, 3} in the main code. In fact you can't even copy the value of one array to another by going arr1 = arr2 , it seems to treat it as a pointer and you have to use something like .Copy(arr1, arr2)
Then on the other hand it turns out you can go myButton.BackColor = Color.LightGray; which is exactly the sort of thing I would expect to be used as myButton.BackColor(LightGray);
There seem to be load of cases of this. Now each case is fine but how are you meant to know which to use? Is it just a case of getting to know them all or is there actually some kind of syntax philosophy that I'm missing?
Reply
Answers (
2
)
placing flash website template in asp.net page using c#
ListView Print