オブジェクトの配列宣言

 2016/9/1 (木)    

IPoint[] pointArray = new IPoint[2];
pointArray[0] = new PointClass();
pointArray[1] = new PointClass();
pointArray[0].PutCoords(0, 0);
pointArray[1].PutCoords(100, 100);
 
IEnvelope env = new EnvelopeClass();
IEnvelopeGEN envGEN = new EnvelopeClass();
 
//Will not compile.
env.DefineFromPoints(3, ref pointArray);
 
//Does not work.
env.DefineFromPoints(3, ref pointArray[0]);
 
//Works.
envGEN.DefineFromPoints(ref pointArray);
Dim pointArray(1) As IPoint
pointArray(0) = New PointClass
pointArray(1) = New PointClass
pointArray(0).PutCoords(0, 0)
pointArray(1).PutCoords(100, 100)
 
Dim env As IEnvelope
Dim envGEN As IEnvelopeGEN
env = New EnvelopeClass
envGEN = New EnvelopeClass
 
'Will not compile.
env.DefineFromPoints(2, pointArray)
 
'Does not work.
env.DefineFromPoints(2, pointArray(0))
 
'Works.
envGEN.DefineFromPoints(pointArray)

http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//000100000151000000

Copyright© WINGFIELD since1981 , 2018 All Rights Reserved.