vb.net有關Structure內部宣告的成員名稱 |
尚未結案
|
pony.huang
一般會員 ![]() ![]() 發表:4 回覆:4 積分:6 註冊:2008-12-09 發送簡訊給我 |
|
sryang
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:39 回覆:762 積分:920 註冊:2002-06-27 發送簡訊給我 |
|
pedro
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:152 回覆:1187 積分:892 註冊:2002-06-12 發送簡訊給我 |
根據sryang兄所提供的參考網址, 小試了一下
要取得什麼類型的成員, 取決於type.GetMember("*", MemberTypes.Property, (BindingFlags.Public Or BindingFlags.Instance))這一行所給的參數 [code vb] Imports System.Reflection Module Module1 Public Class User Property Name Property Telephone Property eMail Function GetName() As String Return Name End Function Function GetTelephone() As String Return Telephone End Function End Class Sub GetPublicInstanceMethodMemberInfo() Dim user As New User Dim type As Type = user.GetType Dim infoArray As MemberInfo() = type.GetMember("*", MemberTypes.Property, (BindingFlags.Public Or BindingFlags.Instance)) If (infoArray.Length > 0) Then Console.WriteLine(ChrW(10) & "The public instance property(s) for type {0}:", type) Dim i As Integer For i = 0 To infoArray.Length - 1 Console.WriteLine("Member {0}: {1}", (i 1), infoArray(i).ToString) Next i Else Console.WriteLine("No members match the search criteria.") End If End Sub Sub Main() GetPublicInstanceMethodMemberInfo() Console.ReadLine() End Sub End Module [/code] ===================引 用 sryang 文 章=================== https://msdn.microsoft.com/zh-tw/library/1dk6tw7k(v=vs.110).aspx
編輯記錄
pedro 重新編輯於 2016-05-16 17:48:35, 註解 無‧
|
Ktop_Robot
站務副站長 ![]() ![]() 發表:0 回覆:3511 積分:0 註冊:2007-04-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |