This is just a logical problem check. I have the following block of code:The attempt to call the member function is generating the the following Error: Use of unassigned local variable, does this mean the assignment is only valid within the logical parentheses block? I know if the if statement within which assignement takes places evaluates to false the variable will never be assigned.Code:for (int i = 0; i < deviceCount; i++) { uint pcbSize = 0; DeviceInfo dInfo; <==== Declared here within the for loop deviceName = string.Empty; RAWINPUTDEVICELIST rid = (RAWINPUTDEVICELIST)Marshal.PtrToStructure(new IntPtr((devList.ToInt32() + (dwSize * i))), typeof(RAWINPUTDEVICELIST)); GetRawInputDeviceInfo(rid.hDevice, RIDI_DEVICENAME, IntPtr.Zero, ref pcbSize); if (pcbSize > 0) { IntPtr pData = Marshal.AllocHGlobal((int)pcbSize); GetRawInputDeviceInfo(rid.hDevice, RIDI_DEVICENAME, pData, ref pcbSize); deviceName = (string)Marshal.PtrToStringAnsi(pData); if (rid.dwType == RIM_TYPEKEYBOARD || rid.dwType == RIM_TYPEHID || rid.dwType == RIM_TYPEMOUSE) { dInfo = new DeviceInfo(); <== assignment starts here dInfo.deviceName = (string)Marshal.PtrToStringAnsi(pData); dInfo.deviceHandle = rid.hDevice; dInfo.deviceType = GetDeviceType(rid.dwType); string DeviceDesc = ReadReg(deviceName); dInfo.deviceName = DeviceDesc; } Marshal.FreeHGlobal(pData); } dInfo.outputDeviceInfo(); <== An attempt to call member function here. (Still within for loop block code) }//end for loop