الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

List Of Subtype

مغلق
بدأه malek_sa في 2 يناير 2008 · 1 رد · 537 مشاهدة · في Microsoft Visual C#.NET
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كيف يمكن عمل List التالية :

List<A> list1= null;
list1 = new List<SubA_1>();
list1 = new List<SubA_2>();

في جافا أذكر أنها :

List <? extends A> list1 = new List<SubA_1>()

تم تعديل هذه المشاركة بواسطة malek_sa في 2 يناير 2008 في 12:21

SCJP 5.0

#2

السلام عليكم

ربما هذا المثال سيفيدك

 
 using System;
 using System.Collections.Generic;
 using System.Text;

 namespace WMAPIsDictionary
 {

	 public class WMMethod
	 {
		 public string Name;
		 public string Library;
		 public string Declaration;
		 public string OS_Versions;

		 public WMMethod(string Name, string Library, string Declaration, string OS_Versions)
		 {   this.Name = Name;
			 this.Library = Library;
			 this.Declaration = Declaration;
			 this.OS_Versions = OS_Versions;
		 }

		 public List<WMMethod> values;

		 public void Populate()
		 {   values = new List<WMMethod>();
			 values.Add(new WMMethod("RegisterHotKey", "coredll.dll", "[DllImport(\"coredll.dll\")]\nprotected static extern uint RegisterHotKey(\nIntPtr hWnd, \nint id, \nuint fsModifiers, \nuint vk);", "Windows CE 1.0 and later."));
			 values.Add(new WMMethod("UnregisterFunc1", "coredll.dll", "[DllImport(\"coredll.dll\")]\nprotected static extern uint UnregisterFunc1(\nuint fsModifiers, \nint id);", "Windows CE 1.0 and later."));
		 }
  }

هذا الموضوع مغلق.

مواضيع مشابهة