私の問題の簡単な例を挙げましょう。エラーを理解できないようです:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NetApp.Manage;
namespace Toaster.Library
{
class NetappConnection
{
private string Hostname {get; set;}
private int ApiMajor {get; set;}
private int ApiMinor {get; set;}
private string Username {get; set;}
private string Password {get; set;}
private NaServer NetappServer {get; set;}
public void NetappConnection(string Hostname, int ApiMajor, int ApiMinor, string Username, string Password)
{
this.Hostname = Hostname;
this.ApiMajor = ApiMajor;
this.ApiMinor = ApiMinor;
this.Username = Username;
this.Password = Password;
this.ConnectToNetapp();
}
private void ConnectToNetapp()
{
NaServer s = new NaServer(this.Hostname, this.ApiMajor, this.ApiMinor);
s.ServerType = NaServer.SERVER_TYPE.FILER;
s.TransportType = NaServer.TRANSPORT_TYPE.HTTP;
s.Port = 80;
s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD;
s.SetAdminUser(this.Username, this.Password);
this.NetappServer = s; <<-- Error: Ambiguity between 'Toaster.Library.NetappConnection.NetappServer' and 'Toaster.Library.NetappConnection.NetappServer()'
}
public NaServer NetappServer()
{
return this.NetappServer;
}
}
}
私はあなたに正直に言うとC#の初心者です。しかし、なぜこれが不可能なのか理解できません。oからthis.Variableへの参照を渡すためですか?
これの目標は、NaServerオブジェクトを再利用できるようにすることです。