» Home » cast » Page 1
In LINQ to Objects, myCollection.Cast<MyType>().First() will cast the entire collection or just the first element?
Category : 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.


View Replies


cast error->System.Windows.Forms.DataGridViewSelectedCellCollection' does not contain a definition for 'Cast'
Category : 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?)


View Replies


List<TEntity>.Cast<BusinessObject>() fails when implicit cast exists
Category : 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
{
pu

View Replies


How to solve cast issue java.lang.ClassCastException: $Proxy cannot be cast to NotEmpty wich is annotation
Category : 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
*/
@Target({METHOD, FIELD, ANNOTATION_TYPE})
@Retention(RUNTIME)
@Constraint(validatedBy = {INotEmptyValidator.class})
public @inter

View Replies


How do I cast a string to integer and have 0 in case of error in the cast with PostgreSQL?
Category : 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


View Replies


Invaid cast exception, even when I have an implicit cast operator defined (in asp mvc app)
Category : 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){...}

View Replies


Is there any way to cast needed class object to another at runtime without direct cast in .net?
Category : 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

View Replies


Cast from Void* to TYPE* using C++ style cast: static_cast or reinterpret_cast
Category : 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);
}

or


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

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


View Replies


The Difference in Cast Iron and Cast Aluminum Pans
Category : Food & Drink
Cast iron and cast aluminum are both excellent choices for home and camping cookware. Each metal has distinct advantages and disadvantages. When considering which metal best meets your requirements, compare six important quality differences. Weight, heat conduction, heat retention, reactivity, toxicity and price vary from metal to metal and are the most important qualities you need to consider.

View Replies


Generic covariant cast or cast to real type
Category : 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

View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .