Search code examples
c#bitconverter

C# BitConverter error


I am getting an error when i try to start my c# program (please not im not very good a programming so if you could write the answer in very simple terms, that would be appreciated)

byte[] buffer = BitConverter.GetBytes(Convert.ToInt32(value));                
PS3.SetMemory(offset, buffer);

Here is a picture of there error - http://prntscr.com/7s2uq9

The error reads "The type or namespace name 'GetBytes' does not exist in the namespace 'BitConverter' (are you missing an assembly reference?) "

I have already tried these
- rewriting the code
- rewriting the namespace references at the top (http://prntscr.com/7s2vf6)

My "using Reference things are" -

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using PS3Lib;
using MetroFramework.Forms;
using MetroFramework;
using SimdiBo2;

Solution

  • You have a namespace BitConverter which confuses the compiler. Either rename your local namespace, or use the fully qualified name for the class:

    System.BitConverter.GetBytes(...);