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
Benjamin Ashton
NA
15
7.4k
The difference between declaring something and making it equal to a new?
Jul 11 2012 6:37 AM
I am quite new to C# and am moving over from a mediocre knowledge of Pascal, so theres quite a bit new construct to learn. There is probably 2 very simple answers to my questions, but I have done some research and have not found any explanation I can relate too, so I would be grateful if someone could help me out.
First Question
What is the difference between declaring something with just its type and declaring it as well as making it equal to a "new" of the same type?
//Simple declaration
Int myInteger;
Random myRand;
//Making it equal to the same type
Int myInteger = new Integer();
Random myRand = new Random();
Second Question
I am fully trying to understand how Static works, but struggling and just end up making everything static because you need static variables inside your static main and so on. I know its something to do with only running the program once, but would really need a simple and clear explanation of it before I can move on to fully understanding the complications of it, maybe a with a metaphor would help.
Thanks for the help, and I look forward to replies!
Reply
Answers (
7
)
validate in the textbox user to restrict
How to call a swap function from from2 to form2