Click here to Skip to main content
15,910,234 members
Home / Discussions / C#
   

C#

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:36
cofounderChris Maunder12-Jul-09 22:36 
PinnedHow to get an answer to your question Pin
Chris Maunder10-Nov-05 16:31
cofounderChris Maunder10-Nov-05 16:31 
QuestionHow to update UI control inside Parallel.ForEach ? Pin
Martin Adams 202345mins ago
Martin Adams 202345mins ago 
QuestionNeed Help with Optimizing My C# Code for Better Performance Pin
Steves Smith31-May-24 1:25
Steves Smith31-May-24 1:25 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
charlieg31-May-24 1:34
charlieg31-May-24 1:34 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Richard Deeming31-May-24 1:44
mveRichard Deeming31-May-24 1:44 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Maximilien31-May-24 1:56
Maximilien31-May-24 1:56 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
abmv31-May-24 2:23
professionalabmv31-May-24 2:23 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
OriginalGriff31-May-24 2:39
mveOriginalGriff31-May-24 2:39 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
PIEBALDconsult31-May-24 2:52
mvePIEBALDconsult31-May-24 2:52 
AnswerRe: Need Help with Optimizing My C# Code for Better Performance Pin
Dave Kreskowiak31-May-24 12:39
mveDave Kreskowiak31-May-24 12:39 
Questionhow to get repository user list and and user group from Azure DevOps Pin
arjunmca28-May-24 21:49
arjunmca28-May-24 21:49 
AnswerRe: how to get repository user list and and user group from Azure DevOps Pin
OriginalGriff28-May-24 22:27
mveOriginalGriff28-May-24 22:27 
GeneralRe: how to get repository user list and and user group from Azure DevOps Pin
trønderen29-May-24 5:21
trønderen29-May-24 5:21 
Questiontelegram client api to download video files and/or telegram video link Pin
Tony Germanos28-May-24 6:59
Tony Germanos28-May-24 6:59 
AnswerRe: telegram client api to download video files and/or telegram video link Pin
OriginalGriff28-May-24 18:19
mveOriginalGriff28-May-24 18:19 
GeneralAD Sync Manager - a free tool to easily monitor and manage your AD to Azure AD sync Pin
TheITApprentice21-May-24 18:29
TheITApprentice21-May-24 18:29 
GeneralRe: AD Sync Manager - a free tool to easily monitor and manage your AD to Azure AD sync Pin
OriginalGriff21-May-24 18:30
mveOriginalGriff21-May-24 18:30 
QuestionHow to convert XML to text file Pin
Member 1211605220-May-24 19:37
Member 1211605220-May-24 19:37 
AnswerRe: How to convert XML to text file Pin
Richard Deeming20-May-24 21:32
mveRichard Deeming20-May-24 21:32 
AnswerRe: How to convert XML to text file Pin
trønderen21-May-24 4:43
trønderen21-May-24 4:43 
AnswerRe: How to convert XML to text file Pin
jschell21-May-24 12:27
jschell21-May-24 12:27 
AnswerRe: How to convert XML to text file Pin
OriginalGriff21-May-24 19:02
mveOriginalGriff21-May-24 19:02 
QuestionWhere to hand over the instance of my plugin dll class to another class Pin
AtaChris18-May-24 8:34
AtaChris18-May-24 8:34 
AnswerRe: Where to hand over the instance of my plugin dll class to another class Pin
OriginalGriff18-May-24 20:20
mveOriginalGriff18-May-24 20:20 
You can't use new(this) in a property initializer as the initializer would require the whole object to be initialised by that point, and that cannot be the case because the constructor has not been called yet. And obviously, the constructor can't be called until all property and field initializers are complete!

So you would end up with a deadlock: the instance can't be created because to create the instance you need access to the fully constructed instance! Laugh | :laugh:

What you can do is move the initializer to the constructor:
public class Bar
    {
    public Bar(Foo foo) { }
    }
public class Foo
    {
    public Bar bar  {get; set;}
    public Foo ()
    {
        bar = new(this);
    }
}

"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!

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.