FAQ Database Discussion Community


Datagridview valuetype property not changing

vb.net,datagridview,double,value-type
I have some code to convert the datatypes of some of the columns of a datagridview into a double, as they should be displaying as currency in my grid view. However when I run the code, the values are still displayed as a normal decimal. Am I using the wrong...

In which scenarios would you initialize a value type with a new keyword?

c#,initialization,value-type
My question is about using new for a value type (int, bool,...) int i = new int(); in this case i is initialized with a value zero. I have read that it's not a good thing to use new with the value types and does not, however, dynamically allocate memory(just...

Traits class to extract container's value_type from a back_insert_iterator

c++,iterator,typetraits,value-type,inserter
The std::back_insert_iterator has value_type equal to void, but it also has a protected member container that holds a pointer to the underlying Container. I am trying to write a traits class to extract the container's value_type, along these lines: #include <iterator> #include <type_traits> #include <vector> template<class OutputIt> struct outit_vt :...

How can I implement Value Types in Slick?

hibernate,slick,value-type
In Hibernate working with Value Types is something similar to this: Having a Table User (Name, Surname, Address), if I want Address to have more fields but not to be an Entity, Hibernate allows me to create an embeddable class like this: @Embeddable public class Address{ private String street; private...

Calculate Value Types (int, float, string) Sizes In C# With Generic Method

c#,generics,types,.net-4.0,value-type
I want to write method which calculate value types size. But i can't give value types (int, double, float) as method parameter. /* *When i call this method with SizeOf<int>() and *then it returns 4 bytes as result. */ public static int SizeOf<T>() where T : struct { return Marshal.SizeOf(default(T));...

How to use macros for concise, type-safe, unboxed enum?

scala,enums,metaprogramming,value-type,scala-macros
I am learning Scala macros and thinking of this as an exercise. Is it possible to use Scala macros to write down something like this (maybe not exactly this concrete syntax, but something without boilerplate) enum DayOfWeek = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday |...