473,738 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CLS-Compliance and Array Parameter Rank

TC
I just upgraded some code to VB 2005. When I did so, Visual Studio
generated several warnings telling me about things which weren't quite
perfect in my code. I resolved all the warnings except one. I need help
with this one.

'Public Function Multiply(A(,) As Double, B() As Double) As Double()'
is not CLS-compliant because it overloads 'Public Function
Multiply(A(,) As Double, B(,) As Double) As Double(,)' which differs
from it only by array of array parameter types or by the rank of the
array parameter types.

Apparently, my code is not CLS-compliant because B() has the same
parameter signature as B(,) under the CLS rules. I understand this
problem, but I don't know how to fix it.

The only solution I see is to stop overloading (i.e. change the name of
one of the two functions), but that will change the public signature of
my code. Can anyone suggest a better solution?
-TC

May 28 '06 #1
3 2044
>The only solution I see is to stop overloading (i.e. change the name of
one of the two functions), but that will change the public signature of
my code. Can anyone suggest a better solution?


If you don't care about CLS compliance you can apply the
CLSCompliant(Fa lse) attribute to the method to get rid of the warning.
Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
May 29 '06 #2
TC
Mattias,

Thanks for the advice. Unfortunately, I'm forced to care about CLS
compliance. The module in question is referenced by many projects, some
of which must be CLS compliant.

-TC

May 29 '06 #3
TC,
What Mattias was suggesting was:

<Assembly: CLSCompliant(Tr ue)>

Public Class Something

<CLSCompliant(F alse)> _
Public Function Multiply(ByVal A(,) As Double, ByVal B() As Double) As
Double()
Return Nothing
End Function

Public Function Multiply(ByVal A(,) As Double, ByVal B(,) As Double) As
Double(,)
Return Nothing
End Function

End Class

You can have the entire assembly CSL compliant, except selected types &
methods, as above.

NOTE: I don't know why but it makes a difference which one you use
<CLSCompliant(F alse)> on...

This is similar to System.Convert. ToUInt32() method. The System.Convert
class is CLS Compliant, however the ToUInt32 is not, as UInt32 is not.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"TC" <go*********@ya hoo.com> wrote in message
news:11******** **************@ j33g2000cwa.goo glegroups.com.. .
| Mattias,
|
| Thanks for the advice. Unfortunately, I'm forced to care about CLS
| compliance. The module in question is referenced by many projects, some
| of which must be CLS compliant.
|
| -TC
|
May 29 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
4641
by: BOOGIEMAN | last post by:
I've just finished reading Python turtorial for non-programmers and I haven't found there anything about some usefull commands I used in QBasic. First of all, what's Python command equivalent to QBasic's "goto" ? Secondly, how do I clear screen (cls) from text and other content ? And last, how do I put program to wait certain amount of seconds ? If I remeber correctly I used to type "Wait 10" and QBasic waits 10 seconds before proceeding...
6
413
by: Edward Diener | last post by:
Does anyone know the correct naming conventions for CLS compliant code ? The doc points to a really obscure and difficult to digest document on the web about Unicode names, and I am looking for simpler rules that tell me what names are CLS compliant. Here are some simple questions: 1) Can a CLS compliant name start with an underscore ? 2) Is there a limit to the length of a CLS complaint name ? With a full namespace name ?
192
9492
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
1
3919
by: Pieter | last post by:
Hi, I have this Warning for several forms when using the DockPanel Suite of Weifen Luo in VS.NET 2005. I read a lot about this CLS-compliant stuff, but I don't now how to chech actually which part of the class is not CSL-compliant? Any body knows what to look for? I just want to get rid of these warnings :-) Thanks a lot in advance,
10
6173
by: moondaddy | last post by:
I converted a vb.1.1 web service project to 2.0 and .net 2.0 created / replace some datasets. The code it automatiacly generated gets a warning message as follows: Warning 150 Name '_ClassColumn' is not CLS-compliant. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\wsvipn2006\4b065968\dadaeae0\Sources_App_Code\wsvipn2006.dsuser.xsd.8a6308fa.vb 2606 38 http://localhost/wsVIPN2006/ I'm trying to go through all my...
0
2696
by: manoj.sahu | last post by:
hi all, as per my study CLS is the common set of specification which should by meet by the language which want to target CLS(or .net). and CTS is the set of common types(or common data types) which should be supported by all .net language. to be common data type in all language is neccesary condition but its not suffiicient. means to say common data type may be 1 of the specs but it's not all. and cls means all common specs.
22
4233
by: mp | last post by:
i have a python program which attempts to call 'cls' but fails: sh: line 1: cls: command not found i tried creating an alias from cls to clear in .profile, .cshrc, and /etc/profile, but none of these options seem to work. my conclusion is that a python program that is executing does not use the shell (because it does not recognize shell aliases). is this correct?
11
1449
by: Smokey Grindle | last post by:
This class is coming up as not CLS compliant, why? with this warrning Warning 2 Type 'Account' is not CLS-compliant. Namespace Accounts ''' <summary> ''' Represents an account
1
1197
by: Smokey Grindle | last post by:
Is there a good explination of what would cause a CLS warrning in .NET 2.0 out there anywhere? like list of reasons and examples of what cause an object or type to not be CLS complaint? thanks!
3
21570
by: james_027 | last post by:
hi, is cls & self the same thing? I have seen something like class A: def dosomething(cls): #doing something
0
8968
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9473
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9259
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.