Click here to Skip to main content
15,891,033 members
Home / Discussions / C#
   

C#

 
QuestionLooking for a control Pin
mjmcinto20-Aug-07 3:41
mjmcinto20-Aug-07 3:41 
AnswerRe: Looking for a control Pin
Talal Sultan20-Aug-07 3:45
Talal Sultan20-Aug-07 3:45 
AnswerRe: Looking for a control Pin
Justin Perez20-Aug-07 3:46
Justin Perez20-Aug-07 3:46 
AnswerRe: Looking for a control Pin
Eduard Keilholz20-Aug-07 3:52
Eduard Keilholz20-Aug-07 3:52 
QuestionIs it possible to write such a methode? Pin
MarkPhB20-Aug-07 3:26
MarkPhB20-Aug-07 3:26 
AnswerRe: Is it possible to write such a methode? Pin
Luc Pattyn20-Aug-07 3:40
sitebuilderLuc Pattyn20-Aug-07 3:40 
AnswerRe: Is it possible to write such a methode? Pin
Talal Sultan20-Aug-07 3:42
Talal Sultan20-Aug-07 3:42 
AnswerRe: Is it possible to write such a methode? Pin
Scott Dorman20-Aug-07 4:09
professionalScott Dorman20-Aug-07 4:09 
Based on your example code, you are showing that you want to provide default values to the function parameters when you define the method. To do this you need to provide different overloads to the function.

Based on your explanation, you want to call a method and pass property initializers to it. You can do something close, but you will need to wait until the .NET Framework v3.5 is released (or use the Beta 2 release). The reason I say "close" is that you can only do this on object creation.

For example, if you have a class
C#
public class UserProfile
{
   public int UserId { get; set; }
   public string FirstName { get; set; }
   public string LastName { get; set; }
   pubic UserProfile() { }
}
You can create a new instance like this
C#
UserProfile profile = new UserProfile
{
   UserId = 123
   FirstName = "John"
   LastName = "Smith"
};



Scott.

—In just two days, tomorrow will be yesterday.

[Forum Guidelines] [Articles] [Blog]

AnswerRe: Is it possible to write such a methode? Pin
Eduard Keilholz20-Aug-07 4:18
Eduard Keilholz20-Aug-07 4:18 
AnswerRe: Is it possible to write such a methode? Pin
Rudolf Jan21-Aug-07 0:52
Rudolf Jan21-Aug-07 0:52 
QuestionListBox reordering.. Pin
Dio2220-Aug-07 3:23
Dio2220-Aug-07 3:23 
AnswerRe: ListBox reordering.. Pin
Luc Pattyn20-Aug-07 3:43
sitebuilderLuc Pattyn20-Aug-07 3:43 
GeneralRe: ListBox reordering.. Pin
Dio2220-Aug-07 4:06
Dio2220-Aug-07 4:06 
QuestionException handling..???? Pin
Ron.S20-Aug-07 2:57
Ron.S20-Aug-07 2:57 
AnswerRe: Exception handling..???? Pin
originSH20-Aug-07 3:00
originSH20-Aug-07 3:00 
GeneralRe: Exception handling..???? Pin
Scott Dorman20-Aug-07 4:14
professionalScott Dorman20-Aug-07 4:14 
GeneralRe: Exception handling..???? Pin
originSH20-Aug-07 4:51
originSH20-Aug-07 4:51 
GeneralRe: Exception handling..???? Pin
Scott Dorman20-Aug-07 5:40
professionalScott Dorman20-Aug-07 5:40 
AnswerRe: Exception handling..???? Pin
Talal Sultan20-Aug-07 3:02
Talal Sultan20-Aug-07 3:02 
AnswerRe: Exception handling..???? Pin
Eduard Keilholz20-Aug-07 3:06
Eduard Keilholz20-Aug-07 3:06 
AnswerRe: Exception handling..???? Pin
Rudolf Jan21-Aug-07 0:55
Rudolf Jan21-Aug-07 0:55 
QuestionIMPORT AN EXEL FILE in windows application Pin
nish8520-Aug-07 2:55
nish8520-Aug-07 2:55 
GeneralRe: IMPORT AN EXEL FILE in windows application Pin
Eduard Keilholz20-Aug-07 3:02
Eduard Keilholz20-Aug-07 3:02 
AnswerRe: IMPORT AN EXEL FILE in windows application Pin
Justin Perez20-Aug-07 3:14
Justin Perez20-Aug-07 3:14 
AnswerRe: IMPORT AN EXEL FILE in windows application Pin
Luc Pattyn20-Aug-07 3:46
sitebuilderLuc Pattyn20-Aug-07 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.