|
|
I'm thinking of starting a new project in C#. Or should I wait til 2005 when Visual Studio 2005 (C# 2.0) is released so I wouldn't have to rewrite a lot of code ? How big will the incompatibility between C# 1 and C# 2.0 be ?
Regards, Desmond
|
|
|
|
|
hi Desmond,
I do not feel MS will make such a drastic change in the language
for C# 2.0. I feel they will add support for Generics (Templates ) , Closures etc. ( All these VM languages are introducing back those
features of C++ they thrown away earlier )
IMHO , Stick with C# 1.x and if at all u need to change , it will
be some methods in the new BCL or some of the current classes might be made
deprecated ( As sun often does ! )
Praseed Pai
www.praseedpai.com
|
|
|
|
|
SOCM_FP_CPP wrote:
I do not feel MS will make such a drastic change in the language
for C# 2.0. I feel they will add support for Generics (Templates ) , Closures etc.
You don't think generics are going to be drastic?! Have you been reading everything we are going to get and the impact it will make?
- Nick Parker My Blog | My Articles
|
|
|
|
|
hi Nick ,
Ur right !. Generics are a welcome addition to the C# language. Perhaps
it will change the way we program our data structures and other stuff.
I was anwsering the questions from a code maintanence point of view.
he was more worried about porting C# 1.x to C# 2.0.
Praseed Pai
www.praseedpai.com
|
|
|
|
|
You won't need to rewrite code. There are no breaking changes in the C# language specification, only new support is added. Almost all the classes supported in the .NET BCL (base class library) will be supported as well (I can't say for sure: there's hundreds of classes).
And don't forget the .NET runs side-by-side. I currently have 1.0 SP2, 1.1, and 2.0 Beta installed. If a managed application that targets 1.0 is installed and .NET 1.0 is installed, it will run against that (unless you redirect). If .NET 1.0 is not installed but 1.1 is, it will run against that (it uses the correct or newer Framework by default). You can control this behavior, however. Read Deploying Applications[^] and Configuring Applications[^] in the .NET Framework SDK for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Is there a way to make a program that turns of the monitors. In Power Option Properties, you kan set the time from 1 minute to 5 hours, but I would like a program that could turn of my monitors right away, just clicking on an icon - is't for using when i watch films on a projektor, so only monitor 1 an 2 shold be turnd of, not monitor 3 (the projektor).
|
|
|
|
|
|
Well... I have my reasons, so is there a way or not?
|
|
|
|
|
Use WMI to call the SetPowerState function on an instance of the CIM_DesktopMonitor class and pass 6 as the new power state.
Yes, even I am blogging now!
|
|
|
|
|
Hmm.. sounds quite easy, but sorry, I'm a newbee at C# so how do I do that?
|
|
|
|
|
By reading about the System.Management[^] classes and their examples in the .NET Framework SDK. It's the only way to learn.
You can also download the Management Extensions for Visual Studio .NET from the links below, which installs extensions into VS.NET's Server Explorer. You can find the class you want and drag and drop it to your project ot create a typed ManagementObject (supported properties and methods are reflected on the created type), but all this does is provide a wrapper for calling ManagementObject.InvokeMethod , ManagementObject.Get , and ManagementObject.Put .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Wow, I thought there would be something easy as just function.TurnOffMonitor(x) ...
|
|
|
|
|
Its funny how some think someone else should write their code. Is the monitor power button looking like a more feasible implementation for you?
This is easily a case where one can overuse technology. By the time it takes you to figure out how to use the objects in Management you could have just shut off your monitor.
|
|
|
|
|
Ahrghhh.... I just wanted a little help for a something that mattered to me, but I guess I'll have to stick to what what my newbe skills could to come up with:
<br />
private void Form1_Load(object sender, System.EventArgs e)<br />
{<br />
this.Location = new Point(0,0);<br />
this.BackColor = Color.Black;<br />
this.Size = new Size(1280*2, 1024);<br />
}
all through it doesn't turn off the monitors (since my monitors are backlighted), but at least it dims the light. Thank you guys
|
|
|
|
|
PrebKlok wrote:
Thank you guys
What's the bad mood for? Do you not want to learn anything at all? Do you want to be a newbie forever? I suppose, if that's the manner in which you want things handled you should be upset.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Yeah, right next to DoesEverything.MakeMeCoffee() .
If there was a method or something for every possible feature (which is impossible), what would be the point of having programmers?
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath Stewart wrote:
what would be the point of having programmers?
Programmers are no longer needed in this world, at least not with the newly released API's containing things like this:
IDevelop id = DeveloperFactory.CreateDeveloper();
id.WriteCompleteApplicationWithNoErrors();
- Nick Parker My Blog | My Articles
|
|
|
|
|
|
Heath Stewart wrote:
I guess maybe I should just be a park ranger out in Washington now that Redmond has decided us programmers are absolete.
Hey, if you did, who could blame you - this[^] view looks awesome.
- Nick Parker My Blog | My Articles
|
|
|
|
|
Well, when you an Megan come up to visit (BTW - have a thread about my new job in my blog) we can take you there! And since I'm absolete now with that pesky DoesEverything class, we'll probably just have a cabin (so it's close to work) there!
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Ok, would this be the way to go?
<br />
object [] arg = {6};<br />
ManagementClass mc = new ManagementClass("Win32_DesktopMonitor");<br />
mc.InvokeMethod("SetPowerState", arg);<br />
problem is that I get the an exception:
An unhandled exception of type 'System.Management.ManagementException' occurred in system.management.dll
Additional information: This method is not implemented in any class
|
|
|
|
|
If you followed my directions (downloaded the WMI extensions for VS.NET) and generated a typed class for the Win32_DesktopMonitor CIMv2 class, you might see immediately what was wrong: SetPowerState takes two parameters: a UInt16 and a DateTime .
Change the first line to object[] arg = {6, DateTime.Now}; and it should work.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hmm... changing the line now gives this execption:
An unhandled exception of type 'System.Management.ManagementException' occurred in system.management.dll
Additional information: Type mismatch
I'm not sure if I understood your direction 100%. After having installed the WMI extensions, I opened the Server Explore and browsed to Servers|MyComputerName|Management Clas|Desktop Settings and then I right clicked and chose "Generate Managed Class"
|
|
|
|
|
That's not the right class. You have to right-click on "Management Classes" and add a new class: root\CIMv2\Win32_DesktopMonitor. Generate a new class from that.
Try object[] arg = new object[] {(ushort)6, DateTime.Now}; . It really shouldn't matter since non-decimal numeric types are implicitly convertible, but it's worth a try. This could present a problem since the method is discovered by the types of parameters, and since just 6 would actually be an int (System.Int32 ), that could be the source of the problem.
Microsoft MVP, Visual C#
My Articles
|
|
|
|