In C# you can not set default values for method parameters like in Delphi. So you can not make a method like this:
private int DoSomething(int Start, int End = -1);
The only way to 'simulate' this is using an overloaded method.
What is overloading?
Overloading gives you the possibility to name two methods the same, but they must have different parameters. So in a way you can simulate the default parameters.
In Delphi you must mark this methods as overloaded in C# you can write your methods without any keyword.
When using overloading for 'default' purposes it should be considered that if you don't do this clever you will be put up with two methods with almost te same code, so it is wise to follow the rule that the method with the fewest parameters calls the other one.
So in the DoSomething method:
(A very stupid function indeed :) )
private int DoSomething(int Start, int End);
{
if (End !=- 1)
return Start + End;
else
return Start + 1000;
}
private int DoSomething(int Start);
{
return DoSomething(Start, -1);
//So do not do this, you will end up with two same code paths:
// return Start + 1000;
}
Programming blogs containing .NET, C#, LINQ, Objective-C and Delphi experiences
Friday, July 29, 2005
Friday, July 22, 2005
Making up for .NET 2.0
Visual Studio 2005 and .NET Framework 2.0 will be released in november 2005. Although I am still exploring (and sometimes struggling) with .NET 1.1. it is time to make up for .NET 2.0.
Some things will break, moving from 1.1 to 2.0. Microsoft released a 'List of Breaking Changed' here.
More compatibility issues can be found here.
Updated 29-07-2005
For specific ASP.NET upgrade issues you can look at the upgrade center here.
And for conversion issues here.
Some things will break, moving from 1.1 to 2.0. Microsoft released a 'List of Breaking Changed' here.
More compatibility issues can be found here.
Updated 29-07-2005
For specific ASP.NET upgrade issues you can look at the upgrade center here.
And for conversion issues here.
Tuesday, July 19, 2005
The 24 hours of Delphi audio recordings
The audio recordings of the great '24 hours of Delphi' are now online.
Click here to listen to each session and get to know the faces behind the voices.
Click here to listen to each session and get to know the faces behind the voices.
What is ECO anyway?
Peter Morris has written a BDN article on ECO, called 'What is ECO anyway?'. The article provides a great overview of ECO for the ECO-rookies (like myself).
You really should check this out!
You really should check this out!
Delphi CF Preview available now
According to Danny Thorpe's blogpost today, the Delphi for .NET Compact Framework Technology preview compiler (Wow that sounds just great) is now available for download. (D2005 registred users only).
If you don't have a PDA you can download the Microsoft WinCE emulator here.
If you don't have a PDA you can download the Microsoft WinCE emulator here.
Thursday, July 14, 2005
The day after: I won a price!
The 24 hour Delphi marathon was really cool!
And it becomes even cooler because I won a price!!!. I am now the proud owner of Mastering Delphi 2005 from Marco Cantu.
Thank you Borland !
:-)
And it becomes even cooler because I won a price!!!. I am now the proud owner of Mastering Delphi 2005 from Marco Cantu.
Thank you Borland !
:-)
Wednesday, July 13, 2005
24 Hours Delphi Marathon
It is happening now:
mms://bdntv.borland.com/chat
Login and win prices:
http://test.borland.com/broadcast/
Update:
Replays available here:
http://24hours.rad-on.de
Dutch Time 9.00 pm:
Picture from the session with among other DavidI and Dany Thorpe about compiler (From Anders Ohlson blog)
mms://bdntv.borland.com/chat
Login and win prices:
http://test.borland.com/broadcast/
Update:
Replays available here:
http://24hours.rad-on.de
Dutch Time 9.00 pm:
Picture from the session with among other DavidI and Dany Thorpe about compiler (From Anders Ohlson blog)
Tuesday, July 05, 2005
Winforms, One point!
Today I encountered an easy problem in a Winforms application. I had to set the default button for a form. I know this can hardly be called a problem. :-)
Let me see, in Delphi the TButton has a Default and Cancel property, set them and go. In winforms however buttons do not have that properties $-), well ahumm, after a bit of looking around I finally(yes I admit) found it!
In Winforms the form it self has an property AcceptButton and CancelButton, so you don't have to set a button property. Thinking it over the winforms solution is more logical compared to the VCL solution, where you can set multiple Default buttons for one form, which of course is looking for trouble.
Well I guess (finally) one point for Winforms.
Let me see, in Delphi the TButton has a Default and Cancel property, set them and go. In winforms however buttons do not have that properties $-), well ahumm, after a bit of looking around I finally(yes I admit) found it!
In Winforms the form it self has an property AcceptButton and CancelButton, so you don't have to set a button property. Thinking it over the winforms solution is more logical compared to the VCL solution, where you can set multiple Default buttons for one form, which of course is looking for trouble.
Well I guess (finally) one point for Winforms.
Subscribe to:
Posts (Atom)
Use an image as your UIBarButtonItem
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
In ASP.NET it is easy to set the prefered authentication method in the web.config file. For external websites this is set mostly to Forms ...
-
Using an image as your UIBarButtonItem in your navigationcontroller bar can only be achieved by using a common UIButton as the BarButtonItem...
-
How to get, for example, all the hyperlinks from a webpage, which is loaded in your iPhone app using the UIWebView control? (Xcode's web...