dimanche 19 février 2017

Passing an array to DLL and testing to see if its Null

I am trying to put some code in place to test to see if the array I'm passing to my DLL is empty or not. I'm having some difficulty formulating the 'if' statement to check for this.

int[] values = null;  //1 dimensional array 
Class1.ascendingArray(values);  //Send 1 dimensional array to DLL for ascending sort method

DLL

 namespace DLLProject
    {
        public class Class1
        {
            public static int[] ascendingArray(int[] values)  //Array ascending sorting method
        {
              Array.Sort(values); //Sorts array
              return values;              
        }

Right now the DLL code just sorts and returns the values of the array passed to it. I want to put a check for null statement in there somewhere, but I'm having difficulty. The DLL code also requires that you return something which is another obstacle I'm having with my array null check

Aucun commentaire:

Enregistrer un commentaire