遇到#Pragma警告时会怎么做?

时间:2015-01-04 14:53:04

标签: vb.net

采用以下原始C#代码。

  class Pair
        {
#pragma warning disable 649
            public Customer customer;
            public Order order;
#pragma warning restore 649
        }

一个使用良好的在线转换器产生了以下VB,

  Class Pair
    #Pragma warning disable 649
    Public customer As Customer
    Public order As Order
    #Pragma warning restore 649
End Class

现在VB不支持Instant VB提取并警告你的Pragma警告。

   Private Class Pair
'INSTANT VB TODO TASK: There is no equivalent to #pragma directives in VB:
'#pragma warning disable 649
            Public customer As Customer
            Public order As Order
'INSTANT VB TODO TASK: There is no equivalent to #pragma directives in VB:
'#pragma warning restore 649
        End Class

现在我的问题是这个。我是否只是删除警告并保持原样;

   Private Class Pair
    Public customer As Customer
    Public order As Order

   End Class

或者我应该为这些明确设置值;说一个空字符串或者可能是Null ie;

 Private Class Pair
    Public customer As Customer = NOTHING
    Public order As Order = NOTHING

   End Class

感谢您提供有关此事的任何帮助和见解。

0 个答案:

没有答案