primitive-types

Can I pass a primitive type by reference in Java?

I would like to call a method which could potentially take on different versions, i.e. the same method for input parameters that are of type: boolean byte short int long The way I would like to do this is by "overloading" the method (I think that is the correct term?): public void getValue(byte theByte) {...} public void getValue(sh...

Unity IoC and registering primitive types

Right then, I've run into a situation using Unity that I don't know how to solve/approach...Here's my problem. I'm developing a WPF application and I'm using MVVM (Prism Implimentation hence the Unity container). I have a ViewModel called MenuItemsViewModel (plural) which contains an IEnumerable of MenuItemViewModel (singular). In the...

C# Generics to avoid code repetition?

I am fairly new to C# coming from Java, and I'm wondering if there's a simple way to avoid code repetition involving primitive types like this: private Boolean AtLeastOneBufferItemIsNonZero(int[] Buffer) { Boolean result = false; foreach (int Item in Buffer) { result = !(Item == (int)0); if (result) break; ...

cannot use and object as a parameter to a method - on standard implementation

-(NSString)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component when i try to implement this method, i get the error mentioned but that seems incorrect. i have 2 questions isn't nsinteger a primitive type (not needing to be passed as a pointer)? why does the apple provided implementation...

Uninitialized int vs Integer

Hi all, I was just studying up on my Java in preparation for an exam and I ran into a sort of problem with uninitialized int/Integer values. class A { int x; Integer y; static int z; static Integer z2; public A(){} } Lets say I initialize an object of Class A. A a = new A(); I've tried th...

Where do you put the parentheses to concisely convert a casted object to a primitive type without auto-unboxing?

With autounboxing, this statement will automatically work: int myPrimitive = (Integer) doIt(); But if I want to explicitly convert from an Integer to an int here in a single line, where do I have to put the parentheses? ...

Is String a primitive type?

I am curious about the string and primitive types. Article like this says string is primitive type. However second article on MSDN does not list string as primitive type. However when I ran the code provided in second article, it displays String is not Primitive type. Can any one guide me on this? Thanks, Ram ...