Click here to Skip to main content
14,457,754 members
   

C#

 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
wrightyrx715-Jul-19 2:35
Memberwrightyrx715-Jul-19 2:35 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
OriginalGriff15-Jul-19 2:47
communityengineerOriginalGriff15-Jul-19 2:47 
GeneralRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
phil.o15-Jul-19 2:46
mvephil.o15-Jul-19 2:46 
AnswerRe: C# error: “An object reference is required for the non-static field, method, or property” Pin
Sagar-Jaybhay16-Jul-19 5:19
MemberSagar-Jaybhay16-Jul-19 5:19 
QuestionPowerpoint addin - where to start? Pin
pr1mem0ver12-Jul-19 6:04
Memberpr1mem0ver12-Jul-19 6:04 
AnswerRe: Powerpoint addin - where to start? Pin
OriginalGriff12-Jul-19 6:25
communityengineerOriginalGriff12-Jul-19 6:25 
GeneralRe: Powerpoint addin - where to start? Pin
pr1mem0ver15-Jul-19 15:53
Memberpr1mem0ver15-Jul-19 15:53 
QuestionPredicateBuilder Question Pin
Kevin Marois10-Jul-19 8:32
professionalKevin Marois10-Jul-19 8:32 
I'm trying to create a query with And and Or predicates.

My question is how to form it so that I have all the ANDS, PLUS the ORs:

If this was SQL, I would do
SELECT *
    FROM ValidityRules
    WHERE InstrumentId = 1 AND
          BaySerialNumber = 'ABC123' AND
          AssayType = 'MyType' AND
          (ValdityCode = 'Code1' OR
           ValdityCode = 'Code2' OR
           ValdityCode = 'Code3')
Note that the codes are in parens.

Here's what I have so far:
// Create the predicate
var predicate = PredicateBuilder.New<ValidityRulesEntity>();

// Add the Instrument, Bay Serial Number, and Assay Type
predicate = predicate.And(x => x.InstrumentId == entity.InstrumentId);
predicate = predicate.And(x => x.BaySerialNumber == entity.BaySerialNumber);
predicate = predicate.And(x => x.AssayType == entity.AssayType);

// Now add the codes from the list. This should be in ADDITION to the above conditions.
foreach (var validityCode in entity.ValidityCodes)
{
    predicate = predicate.Or(x => x.ValidityCodes.Equals(validityCode));
}

What's the right way to do this?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: PredicateBuilder Question Pin
Luc Pattyn10-Jul-19 8:41
sitebuilderLuc Pattyn10-Jul-19 8:41 
GeneralRe: PredicateBuilder Question Pin
Kevin Marois10-Jul-19 8:52
professionalKevin Marois10-Jul-19 8:52 
GeneralRe: PredicateBuilder Question Pin
Luc Pattyn10-Jul-19 8:55
sitebuilderLuc Pattyn10-Jul-19 8:55 
QuestionAvoid ASP Page Refresh after button click Pin
ahmadroheed9-Jul-19 19:04
Memberahmadroheed9-Jul-19 19:04 
AnswerRe: Avoid ASP Page Refresh after button click Pin
Gerry Schmitz10-Jul-19 7:22
mveGerry Schmitz10-Jul-19 7:22 
QuestionI have two questions concerning what Visual Studio adds when you make a GUI project Pin
Member 129742359-Jul-19 14:29
MemberMember 129742359-Jul-19 14:29 
AnswerRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
Dave Kreskowiak9-Jul-19 15:06
mveDave Kreskowiak9-Jul-19 15:06 
AnswerRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
BillWoodruff9-Jul-19 18:00
mveBillWoodruff9-Jul-19 18:00 
AnswerRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
OriginalGriff9-Jul-19 21:24
communityengineerOriginalGriff9-Jul-19 21:24 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
BillWoodruff9-Jul-19 23:20
mveBillWoodruff9-Jul-19 23:20 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
OriginalGriff9-Jul-19 23:25
communityengineerOriginalGriff9-Jul-19 23:25 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
BillWoodruff10-Jul-19 8:01
mveBillWoodruff10-Jul-19 8:01 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
OriginalGriff10-Jul-19 9:06
communityengineerOriginalGriff10-Jul-19 9:06 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
Member 1297423510-Jul-19 4:33
MemberMember 1297423510-Jul-19 4:33 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
OriginalGriff10-Jul-19 5:34
communityengineerOriginalGriff10-Jul-19 5:34 
GeneralRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
BillWoodruff10-Jul-19 7:43
mveBillWoodruff10-Jul-19 7:43 
AnswerRe: I have two questions concerning what Visual Studio adds when you make a GUI project Pin
Gerry Schmitz10-Jul-19 7:49
mveGerry Schmitz10-Jul-19 7:49 

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.