I encounter two very strange problems during I wrote programme recently, they
are all about the parameter of two Functions in CodeClass2.
The first is that when I invoke the CodeClass2.AddFunction and I will
firstly pass the Name of function to the method , the Name is a string, I
find that if the Name contains the char '.' (such as
SSystem.Collections.IComparer.Compare), then the method will throw and
ArgumentException which tells me that "the parameter is incorrect", now I am
very sure that the exception is fired by passing a Name containing '.' .
The second problem is very similar to the above one, when I invoke the
CodeClass2.AddProperty , I will firstly pass the Name of Property to the
method, the Name is also a string, I find that if the Name is "this" which
means that I am creating a indexer, the method will throw an
ArgumentException which is the same as the one during I invoke
CodeClass2.AddProperty().
Stevanich - 01 Sep 2007 05:30 GMT
Shang,
The name of a class or property does not include the namespace. It is not
legal to have the following:
Public Class Hello.World
End Class
The CodeClass2 object has a property called Namespace, which can be used to
define the namespace of the class:
http://msdn2.microsoft.com/en-us/library/envdte80.codeclass2.namespace(VS.80).aspx
For the AddProperty method, try passing the class name as the property's
getter and setter name. This bit is just a guess, I haven't tried it.
Hope this helps,
Steve - dotneticated.com
>I encounter two very strange problems during I wrote programme recently,
>they
[quoted text clipped - 13 lines]
> ArgumentException which is the same as the one during I invoke
> CodeClass2.AddProperty().