将不安全的C#代码转换为VB.net [英] Transform C# code with unsafe to VB.net

查看:74
本文介绍了将不安全的C#代码转换为VB.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个问题,

i不知道如何将此代码转换为VB.net,因为它不能使用不安全的结构。

谁能帮我 ?



谢谢



Hello, i have one problem,
i don''t know how to transform this code to VB.net because it can''t use unsafe structure.
Can anyone help me ?

Thank you

////convert BGRA8Packed to BGR8Packed
                        unsafe{
                        UInt32 sizeXold, sizeYold;
                        m_demosaicBitmap.GetSize(out sizeXold,out sizeYold);
                        newFormatBitmap.Resize((UInt32)gige.GVSP_PIXEL_TYPES.GVSP_PIX_BGR8_PACKED, sizeXold, sizeYold, 0, 0);
                        for (UInt32 y = 0; y < sizeYold; y++) {
                            Byte* rl = (Byte *) m_demosaicBitmap.GetRawData(y);
                            Byte* wl = (Byte *) newFormatBitmap.GetRawData(y);
                                for (UInt32 x = 0; x <  sizeXold; x++){
                                    wl[0] = (Byte)rl[0];
                                    wl[1] =(Byte)rl[1];
                                    wl[2] =(Byte)rl[2];                                                             
                                    rl += 4;
                                    wl += 3;
                                }
                            }
                        }





提前谢谢



Thank you in advance

推荐答案

根据互联网上的很多帖子,这是不可能的,因为 VB.NET不支持不安全的代码

你可以在不同的程序集中使用不安全的C#代码并在VB.NET项目中引用它。
According to many posts on Internet, this is not possible, since VB.NET does not support unsafe code.
You can use your unsafe C# code within different assembly and reference it in your VB.NET project.


这篇关于将不安全的C#代码转换为VB.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆