When to use wrapper class and primitive type
Hello All, When i should go for wrapper class over primitive types? Or On what circumstance i should choose between wrapper / Primitive types? ...
Hello All, When i should go for wrapper class over primitive types? Or On what circumstance i should choose between wrapper / Primitive types? ...
Is there any primitive data type that it's safe to not initialize? How about structs like CGPoints or NSRects? ...
Let's say I have a LazySeq of java.lang.Character like (\b \ \! \/ \b \ \% \1 \9 \/ \. \i \% \$ \i \space \^@) How can I convert this to a String? I've tried the obvious (String. my-char-seq) but it throws java.lang.IllegalArgumentException: No matching ctor found for class java.lang.String (NO_SOURCE_FILE:0) [Thrown class clojure...
I want to build a webservice with this signature, which does not throw an exception if param2 is left empty. Is this possible? [WebMethod] public string HelloWorld(string param1, bool param2){} The exception is a System.ArgumentException that is thrown when trying to convert the empty string to boolean. Ideas that have not worked so ...
I need to provide a user a list of all primitive types available and was wondering if there is an Enum in the .net library that has all primitive types, so that I don't have to build one. ...
Hello everyone, A few days ago, I decided to start learning C#. So, I got a book and started reading and practicing with code. I was surprised when I saw that string in C# is considered a primitive type. But I was more surprised when I saw that string, as well as all the other primitive types in C# have operations. I'm a Java developer...
Wrapper class are just fine and their purpose is also well understood. But why do we omit the primitive type ? ...
Hello, everyone! I need to do lots of conversions between primitivetype[] and boxedtype[] (both directions). Such as: Integer[] <-> int[], Double[] <-> double[], ... I wanted to know, if there's some quasi-standards APIs out there, which provide such functionality, before I write such utility methods by myself. Java has 8 primitive ty...
Hello, everyone! I need to be able to convert byte arrays to/from other primitive type arrays, but instead of casting, I need type punning. Correct term for raw copy without casting? I thought it would be possible to do the following: // idea: byte[12] -> int[3], and int[3] -> byte[12] int[] ints; ByteBuffer bb = ByteBuffer.wrap( ...
Hi Everyone, I've been learning Java in my spare time and have a quick question I can't seem to figure out. This code returns true: Boolean testBool = true; Boolean test = testBool instanceof Object; System.out.println(test); However, I thought Boolean was a primitive type and when I try this same logic with any other primitive type...
Hi everybody. I'm running into this problem when trying to call a SOAP Web Service from within a Biztalk orchestration. The Web Service is an abapi exposed by SAP as a SOAP Web Service, and the signature of the web method I want to call is something like this: Operation(param1 as System.String, param2 as System.String, param3 ArrayOfS...
hello I would like to know if there is a difference in speed between computing hash value (for example std::map key) of primitive integral type, such as int64_t and pod type, for example struct { int16_t v[4]; };. what about int128_t versus struct {int32_t v[4];}? I know this is going to implementation specific, so my question ultimat...
Hi Guys I have a block of code that serializes a type into a Html tag. Type t = typeof(T); // I pass <T> in as a paramter, where myObj is of type T tagBuilder.Attributes.Add("class", t.Name); foreach (PropertyInfo prop in t.GetProperties()) { object propValue = prop.GetValue(myObj, null); string stringValue = propValue != null ...
I was wondering about the last constructor for std::string mentioned here. It says: template<class InputIterator> string (InputIterator begin, InputIterator end); If InputIterator is an integral type, behaves as the sixth constructor version (the one right above this) by typecasting begin and end to call it: string(static_cast<size_t...
In which case should you use primitive types(int) or reference types (Integer)? This question sparked my curiosity. ...
I'm using Stylecop to come up with some custom rules and I'm trying to determine if I have a double or a float. I'm able to walk through the statement and get a CSTokenType. The CSTokenType is number and can be read as a string. But since it's just a Number I have no real way of knowing if it's an int, float , long , double or whate...
Primitive types are not allowed in ArrayList, source. Partial solution: you can wrap prim.types such as int to Integer to form an extra class but a side effect. I want to index data, is there some substitute for ArrayList that allows primitive types? ...
I know the question sounds silly, but consider this: I have an array of ints (1..N) and a labelling algorithm. at any point the item the int represents is in one of three states. The current version holds these states in a byte array, where 0, 1 and 2 represent the three states. alternatively, I could have three arrays of boolean - one f...
Is there a way to initialize an array of primitives, say a integer array, to 0? Without using a for loop? Looking for concise code that doesn't involve a for loop. :) ...
Hi, Can someone complete the code on an easy way? float[] floats = {...}; // create an array // Now I want to create a new array of ints from the arrays floats int[] ints = ????; I know I can simply cast element by element to a new array. But is it possible on an easier way? Thanks ...