本文介绍了帮助我使用CLSCompliant属性:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:



使用System;

使用System.Collections.Generic;

使用System.Linq;

使用System.Text;

[assembly:CLSCompliant(true)]

命名空间AttributeCLSComplaint

{

class Abc

{

UInt32 y;

[CLSCompliant(true)]

public UInt32 meth1()

{

UInt32 x = 10; ut

返回x;

}

}

class program

{

static void Main(string [] args)

{

Abc a = new Abc();

UInt32 x = a.meth1();

控制台。 WriteLine(x);

}

}



}



我的主题是在这里使用CLSCompliant属性;根据需要,我写了所有必需的属性但是收到警告:不会对AttributeCLSComplaint.Abc.meth1()执行CLS合规性检查,因为从该程序集外部看不到通过在下面显示警告符号:CLSComplaint( true)高于meth1()..

This is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
[assembly:CLSCompliant(true)]
namespace AttributeCLSComplaint
{
class Abc
{
UInt32 y;
[CLSCompliant(true)]
public UInt32 meth1()
{
UInt32 x = 10;ut
return x;
}
}
class Program
{
static void Main(string[] args)
{
Abc a = new Abc();
UInt32 x=a.meth1();
Console.WriteLine(x);
}
}

}

My theme is to use CLSCompliant Attribute over here; As needed, i wrote all the required attributes but am getting a warning: "CLS compliance checking will not be performed on AttributeCLSComplaint.Abc.meth1() because it is not visible from outside this assembly" by showing a warning symbol below: CLSComplaint(true) which is above meth1()..

推荐答案


这篇关于帮助我使用CLSCompliant属性:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-11 00:16