最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - CodeDOm and jagged array - Stack Overflow

programmeradmin1浏览0评论

I have a jagged array created from a XSD. The type is:

object[][][] myobject;

Using CodeDom, I want to create some functions and one returns an instance of this object, something like:

object[][] MyItem(int num)=> myobject[num];

But I can't get that type using the CodeDom functions. Though if it was a simple array, like:

object[] myobject;

I could use

CodeTypeReference.BaseType

And I would get

object MyObject(int num)=>myobject[num];

Unfortunately BaseType is specified as follows:

This property contains the name of the type unless it is an array type, in which case it is the array element type.

Note The name of the property may be misleading. This property contains just the type name with any array adornments or generic type arguments removed, not the base or parent type as might be expected. For example, the BaseType value for System.Collections.Generic.Dictionary2[[System.String], [System.Collections.Generic.List1[[System.Int32]]]] is System.Collections.Generic.Dictionary`2.

Is it possible in the case of a jagged array to get the real base type which would be in my case?

object[][]
发布评论

评论列表(0)

  1. 暂无评论