tagged [constraints]
XML Serialize boolean as 0 and 1
XML Serialize boolean as 0 and 1 The XML Schema Part 2 specifies that an instance of a datatype that is defined as boolean can have the following legal literals {true, false, 1, 0}. The following XML,...
- Modified
- 2 Dec at 14:2
Unique Key constraints for multiple columns in Entity Framework
Unique Key constraints for multiple columns in Entity Framework I'm using Entity Framework 5.0 Code First; I want to make the combination between `FirstColumn` and `SecondColumn`
- Modified
- 17 Feb at 14:50
Display names of all constraints for a table in Oracle SQL
Display names of all constraints for a table in Oracle SQL I have defined a name for each of the constraint for the multiple tables that I have created in Oracle SQL. The problem is that to drop a con...
- Modified
- 26 Aug at 16:36
Is there a generic constructor with parameter constraint in C#?
Is there a generic constructor with parameter constraint in C#? In C# you can put a constraint on a generic method like: Where you specify that `T` should have a constructor that requires no parameter...
- Modified
- 25 Dec at 02:53
How to assert that collection contains only one element with given property value?
How to assert that collection contains only one element with given property value? How do I assert that collection contains only one element with given property value? For example: ``` class Node { p...
- Modified
- 5 Jul at 04:21
Why does a Generic<T> method with a "where T : class" constraint accept an interface
Why does a Generic method with a "where T : class" constraint accept an interface I have this `interface`: and this generic method (with a `T : class` constraint): and this call: and everything compil...
- Modified
- 15 Nov at 13:44
Timing problem in C
Timing problem in C I dont have good experience on c... i just want to learn some of the practical scenarios to be implemented in c.... for example how can i implement the following in C code... y=1 w...
- Modified
- 6 Dec at 09:7
Pros/cons of different methods for testing preconditions?
Pros/cons of different methods for testing preconditions? Off the top of my head, I can think of 4 ways to check for null arguments: I've always used the last method, but I just saw a code snippet tha...
- Modified
- 25 Nov at 23:37
Why does Nullable<T> not match as a reference type for generic constraints
Why does Nullable not match as a reference type for generic constraints > [Nullable type as a generic parameter possible?](https://stackoverflow.com/questions/209160/nullable-type-as-a-generic-parame...
- Modified
- 23 May at 12:16
How to truncate a foreign key constrained table?
How to truncate a foreign key constrained table? Why doesn't a on `mygroup` work? Even though I have `ON DELETE CASCADE SET` I get: > ERROR 1701 (42000): Cannot truncate a table referenced in a foreig...
- Modified
- 9 Jan at 10:14
C# Multiple generic constraints
C# Multiple generic constraints I was wondering if it is possible to add multiple generic constraints? I have an Add method that takes an Object (Either Email, Phone or Address), so i was thinking som...
- Modified
- 19 Feb at 20:16
SQL Server 2008- Get table constraints
SQL Server 2008- Get table constraints Could you help me frame a query that retrieves the constraints in all the tables, the count of constraints in each table, and also display `NULL` for tables that...
- Modified
- 31 Aug at 08:46
C# Generics won't allow Delegate Type Constraints
C# Generics won't allow Delegate Type Constraints Is it possible to define a class in C# such that I couldn't for the life of me accomplish this last night in .NET 3.5. I tried using `delegate, Delega...
- Modified
- 19 Apr at 18:3
What exactly is a "Special Class"?
What exactly is a "Special Class"? After failing to get something like the following to compile: with the error > A constraint cannot be special class `System.Array' I started wondering, what exactly ...
- Modified
- 30 Oct at 12:51
Generic Constraints on function
Generic Constraints on function I want to write a generic function that has a constraint on the type. Specifically I want something like this: The point being that yo
- Modified
- 19 Dec at 14:54
Annotations from javax.validation.constraints not working
Annotations from javax.validation.constraints not working What configuration is needed to use annotations from `javax.validation.constraints` like `@Size`, `@NotNull`, etc.? Here's my code: ``` import...
- Modified
- 26 Mar at 17:10
Specifying constructor constraint for Generic Parameter
Specifying constructor constraint for Generic Parameter I have a collection of objects which I pass as parameter to create objects of another type (one for one). I am doing this in many places (basica...
- Modified
- 4 Aug at 17:21
C# Generic constraints to include value types AND strings
C# Generic constraints to include value types AND strings I'm trying to write an extension method on IEnumerable that will only apply to value types and strings. However 'string' is not a valid constr...
- Modified
- 5 Jan at 16:9
MySQL Removing Some Foreign keys
MySQL Removing Some Foreign keys I have a table whose primary key is used in several other tables and has several foreign keys to other tables. ``` CREATE TABLE location ( locationID INT NOT NULL AUT...
- Modified
- 15 Dec at 11:45
Why Do I need to redeclare type constraint in generic subclass
Why Do I need to redeclare type constraint in generic subclass Recently I tried to create a generic subclass by implementing a generic interface. It seems I can't rely on any of T's restrictions as we...
- Modified
- 8 Jan at 16:59
Why exactly are these "Special Classes"?
Why exactly are these "Special Classes"? After reading [this question](https://stackoverflow.com/questions/29961823) asking what exactly a “Special Class” is, I am left with the question why the six c...
- Modified
- 23 May at 11:46
Foreign key constraint may cause cycles or multiple cascade paths?
Foreign key constraint may cause cycles or multiple cascade paths? I have a problem when I try to add constraints to my tables. I get the error: > Introducing FOREIGN KEY constraint 'FK74988DB24B3C886...
- Modified
- 9 Jul at 20:41
WITH CHECK ADD CONSTRAINT followed by CHECK CONSTRAINT vs. ADD CONSTRAINT
WITH CHECK ADD CONSTRAINT followed by CHECK CONSTRAINT vs. ADD CONSTRAINT I'm looking at the AdventureWorks sample database for SQL Server 2008, and I see in their creation scripts that they tend to u...
- Modified
- 20 Dec at 19:59
Why does a direct cast fail but the "as" operator succeed when testing a constrained generic type?
Why does a direct cast fail but the "as" operator succeed when testing a constrained generic type? ``I've run across an interesting curiosity when compiling some C# code that uses generics with type c...
- Modified
- 3 Oct at 21:28
C# generic methods, type parameters in new() constructor constraint
C# generic methods, type parameters in new() constructor constraint Is there a way to create a Generic Method that uses the `new()` constraint to require classes with constructor attributes of specifi...
- Modified
- 4 Aug at 13:9