473,472 Members | 2,184 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Learning C#

1. Put an application in sleep mode so that it consumes as little PC
resource as possible. When triggered by an event, back to normal/work mode.
After done with work, back to sleep mode again.

How can this be done in C#?

2. Is this wrong?
int *p;
*p = 5; // p is never initialized and could point to anywhere

3. How to pass p as a pointer into a function?

4. "C# is a type-safe language. Variables are declared as being of a
particular type, and each variable is constrained to hold only values of its
declared type." What's the exact meaning of "type-safe" here?

5. In 4, should it say that there are three types for variables in C#:
value, reference, and pointer?

Thanks for your help!


Oct 28 '06 #1
3 2011
"vicmann" <vi*****@hotmail.comwrote in message
news:ua****************@TK2MSFTNGP03.phx.gbl...
1. Put an application in sleep mode so that it consumes as little PC
resource as possible. When triggered by an event, back to normal/work
mode.
After done with work, back to sleep mode again.

How can this be done in C#?
In essentially the same way it would be done using the native Windows API.
The exact method depends on what "event" you mean, but the simplest example
would be to create a waitable event, use the Wait method on it, and
somewhere else use the Set method on the event to signal it and allow the
code sitting at the Wait method to continue.
2. Is this wrong?
int *p;
*p = 5; // p is never initialized and could point to anywhere
You can't even do that in C# without writing "unsafe" code. However, given
that assumption, yes...just as in C it's wrong to dereference an
uninitialized pointer, so too it is in C#.
3. How to pass p as a pointer into a function?
Again, without writing "unsafe" code, you don't. C# does however have a
"ref" keyword that allows passing things by reference.
4. "C# is a type-safe language. Variables are declared as being of a
particular type, and each variable is constrained to hold only values of
its
declared type." What's the exact meaning of "type-safe" here?
I would say "Variables are declared as being of a particular type, and each
variable is constrained to hold only values of its declared type" covers it
pretty well.
5. In 4, should it say that there are three types for variables in C#:
value, reference, and pointer?
No, not really. IMHO the "unsafe" construct is mostly a non-C# thing. That
is, it's a way to write non-C# code within C#. It reminds me a lot of using
the "__asm" keyword in C. With "real" C# code, all you have are values or
references.

Additionally, the kinds of variables don't really have anything to do with
being type-safe. That is, type-safe refers to the type checking when
variables are used. How those variables are stored doesn't relate to how
types are checked. So, no...I wouldn't expect a description of "type-safe"
to necessarily mention the kinds of variables that the language supports.

Pete
Oct 28 '06 #2
Vicman,

Is this for a palm computer or something like that (from that age as well).

On my computer are at the moment almost 500 threads runing waiting on
events, one extra will not harm that in my idea,

Cor

"vicmann" <vi*****@hotmail.comschreef in bericht
news:ua****************@TK2MSFTNGP03.phx.gbl...
1. Put an application in sleep mode so that it consumes as little PC
resource as possible. When triggered by an event, back to normal/work
mode.
After done with work, back to sleep mode again.

How can this be done in C#?

2. Is this wrong?
int *p;
*p = 5; // p is never initialized and could point to anywhere

3. How to pass p as a pointer into a function?

4. "C# is a type-safe language. Variables are declared as being of a
particular type, and each variable is constrained to hold only values of
its
declared type." What's the exact meaning of "type-safe" here?

5. In 4, should it say that there are three types for variables in C#:
value, reference, and pointer?

Thanks for your help!


Oct 28 '06 #3
Put * in C# :-). I still say look at the C# specification, there are plenty
good details in there.
http://msdn2.microsoft.com/en-us/net.../aa497266.aspx

chanmm

"vicmann" <vi*****@hotmail.comwrote in message
news:ua****************@TK2MSFTNGP03.phx.gbl...
1. Put an application in sleep mode so that it consumes as little PC
resource as possible. When triggered by an event, back to normal/work
mode.
After done with work, back to sleep mode again.

How can this be done in C#?

2. Is this wrong?
int *p;
*p = 5; // p is never initialized and could point to anywhere

3. How to pass p as a pointer into a function?

4. "C# is a type-safe language. Variables are declared as being of a
particular type, and each variable is constrained to hold only values of
its
declared type." What's the exact meaning of "type-safe" here?

5. In 4, should it say that there are three types for variables in C#:
value, reference, and pointer?

Thanks for your help!


Oct 28 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ron Stephens | last post by:
The newly rechristened Python Learning Foundation is a web site dedicated to the assistance of people learning the Python programming language. Features include: 1. Daily lists of new and recent...
29
by: Jhon smith | last post by:
Hi,all,I was just wondering if I am likly to have any problems trying to learn C from older books,I have some from the late 80`s,mid/late 90`s. I am using Dev-C++ on the pc windows platform,But I...
4
by: Christian Blackburn | last post by:
Hi Gang, I saw this for sale online: Microsoft Visual Basic.NET Deluxe Learning Edition Version 2003. I'm wondering is the CD that's bundled with the learning edition just a digitized version of...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
7
by: Max | last post by:
On monday I start a semester course in Python (the alternative was Java). I was looking through the course outline and noticed the following: 1) UserDict is used. This is deprecated, right? 2)...
36
by: utab | last post by:
Dear, I have experince in C( numerical projects, like engineering problems, scientific applications) I have the basic notion of C++ also, I have read Accelerated C++ until Chapter 7, however it...
2
by: bokiteam | last post by:
Hi All, Here is my idea to save learning time - Personal learning book. What we really need is somebody really familiar our learning experience, and then takes the example to teach us. Save...
78
by: arnuld | last post by:
hai all, i am standing on a "crossroad to C++". I am here in front of you as i have a problem. i will be brief. Please do not think: "arnuld is sick", i am really struggling & doing hard-work to...
0
by: LK~ICT | last post by:
Sri Lanka rural e-learning project seeks corporate support Dec 04, 2007 (LBO) - A Sri Lankan e-learning initiative for rural students is seeking corporate sector support to expand and cover 400...
16
by: John Salerno | last post by:
Just something that crosses my mind every time I delve into "Learning Python" each night. Does anyone see any value in learning Python when you don't need to for school, work, or any other reason?...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.