[Seasar-s2dotnet 116] コンポーネントメソッド引数の参照渡しについて

ジダン ジネディーヌ zidane1973
2006年 2月 1日 (水) 00:05:15 JST


はじめましてzidane1973と申します。

S2Container.NETを使用してまして、1点気になったのですが、
メソッドから複数の戻り値を呼び出し側に返したいような場合、
引数の参照渡し(ref or ByRef)を使うケースがあると思いますが、
S2Container.NETを使いこのクラスのインスタンスを取得し、
該当メソッドをコールしても参照渡しの変数に値が返ってこないようです。

調べてみたところ、diconファイルの<component>タグ内に<aspect>タグ
があるコンポーネントで上記現象がでているようです。
(<aspect>タグを消したところ正常に動作しました)

解決方法をご存知の方おられますでしょうか?

よろしくお願いします。

【diconファイル】
<?xml version="1.0" encoding="utf-8" ?> 
<!DOCTYPE components PUBLIC "-//SEASAR2.1//DTD S2Container//EN"
"http://www.seasar.org/dtd/components21.dtd">

<components>
	<component class="Seasar.Examples.Intro.HogeImpl">
		<aspect>traceInterceptor</aspect>
	</component>
	<component name="traceInterceptor" 
class="Seasar.Framework.Aop.Interceptors.TraceInterceptor"/>
</components>

【ソース】
namespace Seasar.Examples.Intro
{
	public interface Hoge 
	{
		void ShowMessage();
		void AAA(ref string str);
	}

	public class HogeImpl : Hoge 
	{
		public HogeImpl(string str) 
		{

		}

		public void ShowMessage() 
		{
			Console.WriteLine("Hello World!");
		}

		public void AAA(ref string str)
		{
			str = "<aspect>タグが無ければこれが出力される。";
		}
	}

	public class HelloClient
	{
		private static readonly String PATH = 
"Seasar.Examples/Intro/Hello.dicon";

		public void Main()
		{
			IS2Container container = S2ContainerFactory.Create(PATH);
			Hoge hoge = (Hoge) container.GetComponent(typeof(Hoge));
			hoge.ShowMessage();
			string str = "<aspect>タグがあるとこれが出力される。";
			hoge.AAA(ref str);
			System.Diagnostics.Debug.WriteLine(str);
		}

	}
}

_________________________________________________________________
迷惑メールやウイルスへの対策も万全「MSN Hotmail」 
http://promotion.msn.co.jp/hotmail/ 



seasar-dotnet メーリングリストの案内