Click here to Skip to main content
15,883,901 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problems Related to E commerce APIs Pin
Dave Kreskowiak18-May-16 2:17
mveDave Kreskowiak18-May-16 2:17 
QuestionDynamically Insert A Property Into A LINQ Query Statement Pin
MadDashCoder17-May-16 9:56
MadDashCoder17-May-16 9:56 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Sascha Lefèvre17-May-16 10:32
professionalSascha Lefèvre17-May-16 10:32 
GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
MadDashCoder17-May-16 10:34
MadDashCoder17-May-16 10:34 
GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Sascha Lefèvre17-May-16 11:06
professionalSascha Lefèvre17-May-16 11:06 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Dave Kreskowiak17-May-16 11:17
mveDave Kreskowiak17-May-16 11:17 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Matt T Heffron17-May-16 12:22
professionalMatt T Heffron17-May-16 12:22 
GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
MadDashCoder17-May-16 13:11
MadDashCoder17-May-16 13:11 
Thank all for your valuable inputs especially you Matt. The purpose of this project was just to explore how to dynamically choose a property to be inserted into a LINQ query at runtime. I've learned a lot from everyone's input.

I was able to do what I had originally set out to do using the code below although it is not as elegant as your solution.
C#
public string this[int toyId, string price, string color]
{
     get
     {
      string result = string.Empty;
       if (color != null)
       {
          result = toyList.FirstOrDefault(toy => toy.ID == toyId).Color;
       }
          else if (price != null)
       {
          result = (toyList.FirstOrDefault(toy => toy.ID == toyId).Price).ToString();
       }
       return result;
    }
    set
    {
       if (color != null)
       {
            toyList.FirstOrDefault(toy => toy.ID == toyId).Color = value;
       }
       else if (price != null)
       {
          toyList.FirstOrDefault(toy => toy.ID == toyId).Price = Convert.ToDouble(value);
       }
    }
}

GeneralRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Matt T Heffron17-May-16 14:51
professionalMatt T Heffron17-May-16 14:51 
AnswerRe: Dynamically Insert A Property Into A LINQ Query Statement Pin
Gerry Schmitz19-May-16 6:41
mveGerry Schmitz19-May-16 6:41 
QuestionHow record behavior of a process in windows? Pin
saeedmir17-May-16 7:26
saeedmir17-May-16 7:26 
AnswerRe: How record behavior of a process in windows? Pin
BillWoodruff17-May-16 7:46
professionalBillWoodruff17-May-16 7:46 
GeneralRe: How record behavior of a process in windows? Pin
saeedmir17-May-16 7:52
saeedmir17-May-16 7:52 
GeneralRe: How record behavior of a process in windows? Pin
Eddy Vluggen17-May-16 8:03
professionalEddy Vluggen17-May-16 8:03 
Rant[REPOST] How record behavior of a process in windows? Pin
Richard Deeming17-May-16 7:49
mveRichard Deeming17-May-16 7:49 
QuestionObject is currently in use elsewhere C# - System.Drawing Exception Pin
Django_Untaken16-May-16 21:56
Django_Untaken16-May-16 21:56 
AnswerRe: Object is currently in use elsewhere C# - System.Drawing Exception Pin
Pete O'Hanlon16-May-16 23:09
mvePete O'Hanlon16-May-16 23:09 
Question[Updated] AnyCPU and exposing functionality via COM Pin
Matt T Heffron16-May-16 13:51
professionalMatt T Heffron16-May-16 13:51 
AnswerRe: AnyCPU and exposing functionality via COM Pin
Garth J Lancaster16-May-16 16:28
professionalGarth J Lancaster16-May-16 16:28 
GeneralRe: AnyCPU and exposing functionality via COM Pin
Matt T Heffron17-May-16 7:20
professionalMatt T Heffron17-May-16 7:20 
Questionsearch quickly Pin
Denis Tarasov16-May-16 13:26
Denis Tarasov16-May-16 13:26 
AnswerRe: search quickly Pin
OriginalGriff16-May-16 19:27
mveOriginalGriff16-May-16 19:27 
QuestionHow to create http client server application in C#? Pin
Jaimesh.241115-May-16 21:23
Jaimesh.241115-May-16 21:23 
AnswerRe: How to create http client server application in C#? Pin
Richard MacCutchan15-May-16 22:31
mveRichard MacCutchan15-May-16 22:31 
QuestionHow can i protect c# .net Code to be decompile? Pin
Member 1243103913-May-16 6:39
Member 1243103913-May-16 6:39 

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.