473,386 Members | 1,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 2017
>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(False) 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(True)>

Public Class Something

<CLSCompliant(False)> _
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(False)> 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*********@yahoo.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.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
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...
6
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...
192
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
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...
10
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...
0
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)...
22
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...
11
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
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
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
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.