Question: I have seen other post but can't seem to put it well in my post. Could someone help me with this.i am able to view the files and open them but need them to list from the recent create to oldest. Below is my code. 

```
    private List<String> fileList = new ArrayList<String>();

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

   String root = Environment.getExternalStoragePublicDirectory("/MyAppFolder").
            getAbsolutePath();
    // ListDir(root);

    pdf = new File(root);
    ListDir(pdf);
   }

    void ListDir(File f) {
    File[] files = f.listFiles();
    fileList.clear();

    for (File file : files) {

        fileList.add(file.getName());

    }

    ArrayAdapter<String> directoryList = new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, fileList);

    setListAdapter(directoryList);

  }

  public void onListItemClick(ListView parent, View v, int position, long id) {
    //selection.setText(fileList.indexOf(simple_list_item_1));
    OpenPdf(fileList.get(position).toString());
  }

  public void OpenPdf(String path)
  {
      File file = new File(path);
      if (file.exists()) {
          Uri p = Uri.fromFile(file);
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setDataAndType(p, "application/pdf");
          intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

          try {
              startActivity(intent);
          } 
          catch (ActivityNotFoundException e){
          }
      }
  }
}

```

Answer: 
The closest thing to memcpy in C# is Buffer.BlockCopy, though it is designed for arrays.

This is an [interesting article](http://code4k.blogspot.com/2010/10/high-performance-memcpy-gotchas-in-c.html) on the topic.

I think though that if you were to simplify your code, remove the unsafe and just use plain structs maybe with conversion operators, you would be very surprised by the performance.

Something like; 

```
   public struct Model
   {
      public int B;
      public int C;
      public int D;

      public Model(Dto dto)
      {
         B = dto.B;
         C = dto.C;
         D = dto.D;
      }

      static public implicit operator Model(Dto dto)
      {
         return new Model(dto);
      }
   }

```

would allow you to just say ...

```
     Dto a1 = new Dto { B = 10, C = 20, D = 30 };

     Model m = a1;

```
If both structs have same layout you can just cast pointer and assign like this:

```
var a1 = new Dto { B = 10, C = 20, D = 30 };
var a2 = new Model();

unsafe
{
     fixed (Dto * pa1 = &(a1))
     {
          fixed (Model* pa2 = &(a2))
          {
               *pa2 = *(Model*)pa1;
          }
     }
 }

```