Click here to Skip to main content
15,888,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: Do I need to Lock App.CONFIG for Multithreaded Access ? Pin
Judah Gabriel Himango2-Sep-06 11:18
sponsorJudah Gabriel Himango2-Sep-06 11:18 
Questiondynamically invoking a method in an assemly Pin
Sonu.T2-Sep-06 8:09
Sonu.T2-Sep-06 8:09 
AnswerRe: dynamically invoking a method in an assemly Pin
Stefan Troschuetz2-Sep-06 22:27
Stefan Troschuetz2-Sep-06 22:27 
GeneralRe: dynamically invoking a method in an assemly Pin
Sonu.T3-Sep-06 6:58
Sonu.T3-Sep-06 6:58 
QuestionOpening file Pin
thepersonof2-Sep-06 4:09
thepersonof2-Sep-06 4:09 
AnswerRe: Opening file Pin
Stefan Troschuetz2-Sep-06 4:17
Stefan Troschuetz2-Sep-06 4:17 
GeneralRe: Opening file Pin
thepersonof2-Sep-06 9:45
thepersonof2-Sep-06 9:45 
Questionreflection and implicit Pin
paptelefon2-Sep-06 3:57
paptelefon2-Sep-06 3:57 
Hi
I'm just wondering why I can't use the PropertyInfo class to set the value of a property if I'm using the implicit conversion operator?

How do I get around this problem? I want to use the PropertyInfo.SetValue function, but I need it to work with all datatypes.

Thanks

/mj

==========================================================

Guid oId = new Guid();
MyGuid oMyId = new MyGuid();
MyClass oClass = new MyClass();
PropertyInfo oInfo = oClass.GetType().GetProperty("Id");

oClass.Id = oMyId; // fine...
oClass.Id = oId; // this works fine!
oInfo.SetValue(oClass, oMyId, null); // this is also fine
oInfo.SetValue(oClass, oId, null); // but this doesn't work!!?

==========================================================
These are my classes
==========================================================
public class MyClass
{
private MyGuid m_oId;
public MyGuid Id
{
get { return m_oId; }
set { m_oId = value; }
}
}

public class MyGuid
{
public MyGuid()
{
m_oId = new Guid();
}

public MyGuid(string p_sId)
{
m_oId = new Guid(p_sId);
}

public MyGuid(Guid p_oId)
{
m_oId = p_oId;
}

private Guid m_oId;

public static implicit operator string(MyGuid p_oId)
{
return p_oId.m_oId.ToString();
}

public static implicit operator MyGuid(string p_sId)
{
return new MyGuid(p_sId);
}

public static implicit operator Guid(MyGuid p_oId)
{
return p_oId.m_oId;
}

public static implicit operator MyGuid(Guid p_oId)
{
return new MyGuid(p_oId);
}
}
QuestionSimple event q Pin
thepersonof2-Sep-06 2:38
thepersonof2-Sep-06 2:38 
AnswerRe: Simple event q Pin
Stefan Troschuetz2-Sep-06 3:02
Stefan Troschuetz2-Sep-06 3:02 
GeneralRe: Simple event q Pin
thepersonof2-Sep-06 4:06
thepersonof2-Sep-06 4:06 
QuestionPropertyGrid Refresh Pin
e-laj2-Sep-06 1:15
e-laj2-Sep-06 1:15 
QuestionAssign value to DataGridViewComboBoxCell at run-time Pin
Fouad_kayali1-Sep-06 22:22
Fouad_kayali1-Sep-06 22:22 
AnswerRe: Assign value to DataGridViewComboBoxCell at run-time Pin
Nader Elshehabi1-Sep-06 23:39
Nader Elshehabi1-Sep-06 23:39 
QuestionProlems of creating notepad application in C#? Pin
Stateless1-Sep-06 21:36
Stateless1-Sep-06 21:36 
AnswerRe: Prolems of creating notepad application in C#? Pin
Colin Angus Mackay1-Sep-06 22:50
Colin Angus Mackay1-Sep-06 22:50 
QuestionString comparision method return string. Pin
Abhishek Joshi1-Sep-06 21:03
Abhishek Joshi1-Sep-06 21:03 
AnswerRe: String comparision method return string. Pin
coolestCoder1-Sep-06 21:26
coolestCoder1-Sep-06 21:26 
Questionconnectivity problem with SQL Server Pin
Saira Tanwir1-Sep-06 19:04
Saira Tanwir1-Sep-06 19:04 
AnswerRe: connectivity problem with SQL Server Pin
Marek Grzenkowicz1-Sep-06 23:17
Marek Grzenkowicz1-Sep-06 23:17 
AnswerRe: connectivity problem with SQL Server Pin
Nader Elshehabi1-Sep-06 23:53
Nader Elshehabi1-Sep-06 23:53 
AnswerRe: connectivity problem with SQL Server Pin
beatles16922-Sep-06 23:21
beatles16922-Sep-06 23:21 
GeneralRe: connectivity problem with SQL Server Pin
komal243-Sep-06 21:07
komal243-Sep-06 21:07 
GeneralRe: connectivity problem with SQL Server Pin
beatles16923-Sep-06 22:20
beatles16923-Sep-06 22:20 
GeneralRe: connectivity problem with SQL Server Pin
Saira Tanwir3-Sep-06 22:35
Saira Tanwir3-Sep-06 22:35 

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.