は、あなたの他の質問にいくつか答えます:
は、タイプをサブクラス化する簡単な方法はありますか?
号
私はすべてのメソッドを実装する必要がありますか?
はい。
もしそうなら、これを行うための参考資料はありますか?
あなたがProperties
とMethods
これはあなたが始める方法の一例であるのそれぞれにoverride
-keywordを追加し、あなたはoverride
abstract
プロパティとメソッドのそれぞれに必要です。
public class Test : Type
{
public override Guid GUID
{
get { throw new NotImplementedException(); }
}
}
これは必要とされますが、何も実装されていないすべてのproperties
とmethods
を上書きし、完全なコンパイル可能class
です。
public class Test : Type
{
public override Guid GUID
{
get { throw new NotImplementedException(); }
}
public override bool IsDefined(Type attributeType, bool inherit)
{
throw new NotImplementedException();
}
public override object[] GetCustomAttributes(bool inherit)
{
throw new NotImplementedException();
}
public override string Name
{
get { throw new NotImplementedException(); }
}
protected override bool HasElementTypeImpl()
{
throw new NotImplementedException();
}
public override object[]
GetCustomAttributes(Type attributeType, bool inherit)
{
throw new NotImplementedException();
}
public override Type UnderlyingSystemType
{
get { throw new NotImplementedException(); }
}
public override Type GetElementType()
{
throw new NotImplementedException();
}
protected override bool IsCOMObjectImpl()
{
throw new NotImplementedException();
}
protected override bool IsPrimitiveImpl()
{
throw new NotImplementedException();
}
protected override bool IsPointerImpl()
{
throw new NotImplementedException();
}
protected override bool IsByRefImpl()
{
throw new NotImplementedException();
}
protected override bool IsArrayImpl()
{
throw new NotImplementedException();
}
protected override System.Reflection.TypeAttributes
GetAttributeFlagsImpl()
{
throw new NotImplementedException();
}
public override System.Reflection.MemberInfo[]
GetMember(string name, System.Reflection.BindingFlags bindingAttr)
{
return base.GetMember(name, bindingAttr);
}
public override Type
GetNestedType(string name, System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.PropertyInfo[]
GetProperties(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
protected override System.Reflection.PropertyInfo
GetPropertyImpl(string name, System.Reflection.BindingFlags bindingAttr,
System.Reflection.Binder binder, Type returnType, Type[] types,
System.Reflection.ParameterModifier[] modifiers)
{
throw new NotImplementedException();
}
public override System.Reflection.MemberInfo[]
GetMembers(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override Type[] GetNestedTypes(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.EventInfo[] GetEvents()
{
return base.GetEvents();
}
public override Type[] GetInterfaces()
{
throw new NotImplementedException();
}
public override Type GetInterface(string name, bool ignoreCase)
{
throw new NotImplementedException();
}
public override System.Reflection.EventInfo[]
GetEvents(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.FieldInfo[]
GetFields(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.EventInfo
GetEvent(string name, System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.FieldInfo
GetField(string name, System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
public override System.Reflection.MethodInfo[]
GetMethods(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
protected override System.Reflection.MethodInfo
GetMethodImpl(string name, System.Reflection.BindingFlags bindingAttr,
System.Reflection.Binder binder, System.Reflection.CallingConventions callConvention,
Type[] types, System.Reflection.ParameterModifier[] modifiers)
{
throw new NotImplementedException();
}
public override System.Reflection.ConstructorInfo[] GetConstructors(System.Reflection.BindingFlags bindingAttr)
{
throw new NotImplementedException();
}
protected override System.Reflection.ConstructorInfo
GetConstructorImpl(System.Reflection.BindingFlags bindingAttr, System.Reflection.Binder binder,
System.Reflection.CallingConventions callConvention, Type[] types,
System.Reflection.ParameterModifier[] modifiers)
{
throw new NotImplementedException();
}
public override Type BaseType
{
get { throw new NotImplementedException(); }
}
public override string AssemblyQualifiedName
{
get { throw new NotImplementedException(); }
}
public override string Namespace
{
get { throw new NotImplementedException(); }
}
public override string FullName
{
get { throw new NotImplementedException(); }
}
public override System.Reflection.Assembly Assembly
{
get { throw new NotImplementedException(); }
}
public override System.Reflection.Module Module
{
get { throw new NotImplementedException(); }
}
public override object
InvokeMember(string name, System.Reflection.BindingFlags invokeAttr,
System.Reflection.Binder binder, object target, object[] args,
System.Reflection.ParameterModifier[] modifiers,
System.Globalization.CultureInfo culture, string[] namedParameters)
{
throw new NotImplementedException();
}
}
これらのプロパティが表示されAssemblyQualifiedNameあなたは
- GUID
- BaseType
- を実装する必要があることを取得します
- 名前空間
- フルネーム
- ASSE mbly
- モジュール
- UnderlyingSystemType
- 名前
これらはあなたが
- InvokeMember
- GetConstructorImplを実装する必要がある方法がある
- GetConstructors
- GetMethodImpl
- GetMethods
- GetFieldの
- のGetEvent
- れるGetFields
- GetEvents
- GETINTERFACE
- GetInterfacesメソッド
- GetEvents
- GetNestedTypes
- GetMembers
- GetPropertyImpl
- GetPropertiesの
- GetNestedType
- GetMember
- GetAttributeFlagsImpl
- IsArrayImpl
- IsByRefImpl
- IsPointerImpl
- IsPrimitiveImpl
- ISCO MObjectImpl
- GetElementType
- GetCustomAttributes
- HasElementTypeImpl
- GetCustomAttributes
- は、あなたが見ることができるように、あなたはすべてのコンパイルエラーを除去するためにオーバーライドする必要があるというかなりの数があります
をIsDefinedだからあなたはこれをやりたい本当に良い理由があるか、別のクラス/構造体からのオーバーライドについて考えるか、新しいクラス/構造体を作成するだけです。
**なぜ**タイプ 'をサブクラス化する必要がありますか?それは意味をなさないので、説明してください。 –
少し野性的に聞こえるが、どうしてSystem.Typeをサブクラス化する必要があるのだろうか? – DEHAAS
現在のリフレクションシステムを拡張しようとしている場合(または独自の実装を実装しようとしている場合のみ)、 'Type'をサブクラス化してください。そうでなければ、新しい' struct'を宣言できます。 – dlev