小编Pro*_*oob的帖子

"私有"可见性修饰符 - 如何在将C#转换为VB时处理差异?

的背景

我已经使用DeveloperFusion.com上的转换器将下面的C#代码(在TreeViewAdv文件TreeColumn.cs中找到)转换为VB.net代码.

C#

using System;
//...(other using calls)

namespace Aga.Controls.Tree
{
    [TypeConverter(typeof(TreeColumn.TreeColumnConverter)), DesignTimeVisible(false), ToolboxItem(false)]
    public class TreeColumn : Component
    {
        private class TreeColumnConverter : ComponentConverter
        {
            public TreeColumnConverter()
                : base(typeof(TreeColumn))
            {
            }

            public override bool GetPropertiesSupported(ITypeDescriptorContext context)
            {
                return false;
            }
        }
     }
    //…Some, I believe, unrelated code
}
Run Code Online (Sandbox Code Playgroud)

VB

Imports System.Collections.Generic
‘...(other Imports calls)

Namespace Aga.Controls.Tree

    <TypeConverter(GetType(TreeColumn.TreeColumnConverter)), DesignTimeVisible(False), ToolboxItem(False)> _
    Public Class TreeColumn
        Inherits Component

        Private Class TreeColumnConverter
            Inherits ComponentConverter

            Public Sub New()
                MyBase.New(GetType(TreeColumn))
            End Sub

            Public Overrides Function …
Run Code Online (Sandbox Code Playgroud)

c# vb.net private access-modifiers type-conversion

8
推荐指数
1
解决办法
297
查看次数

Yield Break是否会返回一个值?

我正在将一个C#项目转换为VB.net,需要了解C#的Yield Break.我知道已经有关于Stack Overflow上的Yield Break的问题,但我觉得这些问题有点不同.

1.)当您使用Yield Break时,包含它的函数会向调用者返回一个值吗?如果是这样,它是Null/Nothing,函数类型的默认值,还是其他什么?

2.)当您产生Break时,迭代器重新开始.换句话说,下次调用Iterator时,它会再次返回集合中的第一个项吗?

3.)与Yield Break最接近的vb.net是什么?退出功能?什么都没回来?还有什么?

c# vb.net yield break

4
推荐指数
2
解决办法
2835
查看次数

有问题的指针从C#代码转换为VB.net

为了更好地学习vb.net和C#,我正在进行一个项目(在SourceForge上找到TreeViewAdv)并尝试将其代码转换为VB.虽然我希望能够手动转换代码(因为这是一个学习项目),但我目前正在使用C#到VB代码转换器(在www.DeveloperFusion.com上找到)来推动滚动基本了解第一.我转换的代码大多没有问题,但有一个问题(可能是2).见代码:

C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Drawing.Imaging;

namespace Aga.Controls
{
public static class BitmapHelper
{
    [StructLayout(LayoutKind.Sequential)]
    private struct PixelData
    {
        public byte B;
        public byte G;
        public byte R;
        public byte A;
    }

    public static void SetAlphaChanelValue(Bitmap image, byte value)
    {
        if (image == null)
            throw new ArgumentNullException("image");
        if (image.PixelFormat != PixelFormat.Format32bppArgb)
            throw new ArgumentException("Wrong PixelFormat");

        BitmapData bitmapData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height),
                                 ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
        unsafe
        {
            PixelData* pPixel = (PixelData*)bitmapData.Scan0;
            for …
Run Code Online (Sandbox Code Playgroud)

c# vb.net pointers

3
推荐指数
1
解决办法
2057
查看次数