» Home » cast » Page 1
In LINQ to Objects, myCollection.Cast<MyType>().First() will cast the entire collection or just the first element?
by Niels Kloster in Programming Languages

I want to know whether the Cast() operation is performed on the entire IEnumerable<T> or just on the filtered portion or it.

cast error->System.Windows.Forms.DataGridViewSelectedCellCollection' does not contain a definition for 'Cast'
by Europe in Programming Languages

hi friend i m getting that error can any one plz help

'System.Windows.Forms.DataGridViewSelectedCellCollection' does not contain a definition for 'Cast' and no extension method 'Cast' accepting a first argument of type 'System.Windows.Forms.DataGridViewSelectedCellCollection' could be found (are you missing a using directive or an assembly reference?)

List<TEntity>.Cast<BusinessObject>() fails when implicit cast exists
by rbonestell in Databases

I get an InvalidCastException converting a linq entity list to a businessobject list using the .Cast<> operator.
"Unable to cast object of type 'Ticketing.ticket' to type
'Ticketing.ModelTicket'." (namespace name was changed because underscore was causing unneeded formatting)

here's my business object class

public sealed class ModelTicket

How to solve cast issue java.lang.ClassCastException: $Proxy cannot be cast to NotEmpty wich is annotation
by Liy in Java

i have REST service project integrated with spring.
I am trying to integrate bean validation.
i have done a custom annotation:

* Denotes a field as being no empty.
* @author pguzun
@Constraint(validatedBy = {INotEmptyValidator.class})
public @inter

How do I cast a string to integer and have 0 in case of error in the cast with PostgreSQL?
by Henry in Databases

In postgres I have a table with a varchar column. The data is supposed to be integers and I need it in iteger type in a query. Some values are empty strings.
The following:

SELECT myfield::integer FROM mytable

yields ERROR: invalid input syntax for integer: ""

How can I query a cast and have 0 in case of error during the cast in

Cast from Void* to TYPE* using C++ style cast: static_cast or reinterpret_cast
by clifton anderson in C & C++ & C#

So if your converting from Void* to Type* or from Type* to Void* should you use:

void func(void *p)
Params *params = static_cast<Params*>(p);


void func(void *p)
Params *params = reinterpret_cast<Params*>(p);

To me static_cast seems the more correct but I've seen b

Is there any way to cast needed class object to another at runtime without direct cast in .net?
by eastcoastj in Programming Languages

For example, i have this:

class BasePacket
int header;
int type;
class ChildPacket1 : BasePacket
class ChildPacket2 : BasePacket
BasePacket bp;
Type t;
object obj = CreateNeededChildPacket(out t); //return one of childs as object and it's real type
bp = ...// anyway

Invaid cast exception, even when I have an implicit cast operator defined (in asp mvc app)
by swassbac in ASP & ASP.net

I have an mvc model class created and one of the properties is of type 'MyObject'. It also has a System.ComponentModel.DataAnnotations.StringLength attribute on it.

MyObject as implicit cast operators so it can essentially be used as a string:

public static implicit operator string(MyObject o){...}
public static implicit operator MyObject(string sValue){...}

Generic covariant cast or cast to real type
by gamefreakgcb in Programming Languages

Trying to build a CQRS solution, I have the following code trying to find a Handler and then invoke a Handle() method.

The code below works but it's annoying to use reflection when we know that all IHandleCommand<> have a Handle method, this could be resolved at compiletime, I belive!

Do I have to use dynamic in some way?

public void SendCo

How to Wrap Your Own Body Cast With a Gypsona Plaster Cast
by Paul J Warner in Hobbies, Games & Toys
Before you create a body cast from Gypsona bandages, there are some things to consider. First, plaster gives off heat as it sets and dries. This means a full-body cast should not done all at the same time; either cast your front and back separately or cast whole limbs one at a time. It will take about two to three people to make a body casting: one person to be the model and at least one more to a

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .