{"id":379,"date":"2014-09-17T17:43:05","date_gmt":"2014-09-17T08:43:05","guid":{"rendered":"http:\/\/gomocool.net\/gomokulog\/?p=379"},"modified":"2014-09-17T17:43:05","modified_gmt":"2014-09-17T08:43:05","slug":"vb-net-callbyname-%e4%bd%bf%e3%81%84%e3%81%a9%e3%81%93%e3%82%8d","status":"publish","type":"post","link":"https:\/\/gomokulog.gomocool.net\/?p=379","title":{"rendered":"[VB.NET] CallByName \u4f7f\u3044\u3069\u3053\u308d"},"content":{"rendered":"<p>VisualBasic.NET\u306b\u306f\u3001CallByName\u3068\u3044\u3046\u95a2\u6570\u304c\u3042\u308b\u3002<br \/>\n\u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u3044\u3046\u7269\u306e\u7c21\u6613\u7248\u3067\u3001\u5b9f\u884c\u6642\u306b\u6587\u5b57\u5217\u304b\u3089\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3084\u30e1\u30bd\u30c3\u30c9\u540d\u3092\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n<p>\u307e\u3041\u3001\u3056\u3063\u304f\u308a\u3068\u30b3\u30fc\u30c9\u3092\u304b\u304f\u3002(\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u74b0\u5883\u306f\u3001ASP.NET)<br \/>\n\u307e\u305a\u3001Hotel\u3068\u3044\u3046\u30af\u30e9\u30b9\u304c\u3042\u308b\u3068\u3059\u308b\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">Public Class Hotel\r\n    Private _HotelName As String = \"\u30db\u30b2\u30db\u30c6\u30eb\"\r\n\r\n    Property HotelName() As String\r\n        Get\r\n            Return _HotelName\r\n        End Get\r\n        Set(ByVal value As String)\r\n            _HotelName = value\r\n        End Set\r\n    End Property\r\n\r\n    Public Function GetNews() As String\r\n        Dim content As String = \"\u304a\u98a8\u5442\u3092\u6539\u88c5\u3057\u307e\u3057\u305f\u3002\"\r\n        Return content\r\n    End Function\r\n\r\nEnd Class<\/pre>\n<p>\u3053\u306e\u3068\u304d\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u3084\u30e1\u30bd\u30c3\u30c9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u969b\u306b\u3001\u6587\u5b57\u5217\u304b\u3089\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">    Dim hotel As New Hotel()\r\n\r\n    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\r\n\r\n        Response.Write(hotel.HotelName &amp; \"&lt;br&gt;\")\r\n\r\n        Response.Write(CallByName(hotel, \"HotelName\", CallType.Get) &amp; \"&lt;br&gt;\")\r\n\r\n        CallByName(hotel, \"HotelName\", CallType.Set, \"\u30e2\u30b2\u30db\u30c6\u30eb\")\r\n\r\n        Response.Write(CallByName(hotel, \"HotelName\", CallType.Get) &amp; \"&lt;br&gt;\")\r\n\r\n        Response.Write(CallByName(hotel, \"GetNews\", CallType.Method) &amp; \"&lt;br&gt;\")\r\n\r\n        Response.Write(GetRoomName(2) &amp; \"&lt;br&gt;\")\r\n\r\n    End Sub<\/pre>\n<p>CallByName\u306e\u7b2c\u4e00\u5f15\u6570\u306b\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u6e21\u3057\u3001\u7b2c\u4e8c\u5f15\u6570\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3084\u30e1\u30bd\u30c3\u30c9\u540d\u3092\u5165\u308c\u3066\u3001\u7b2c\u4e09\u5f15\u6570\u306b\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u306eGet\u306a\u306e\u304bSet\u306a\u306e\u304b\u30e1\u30bd\u30c3\u30c9\u306a\u306e\u304b\u3092\u5165\u308c\u308b\u3002(Let\u3063\u3066\u3082\u3042\u308b\u304c\u591a\u5206\u4f7f\u308f\u306a\u3044)<\/p>\n<p>\u57fa\u672c\u7684\u306b\u3001CallByName\u306f\u3001\u666e\u901a\u306b\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3068\u304d\u3088\u308a\u9045\u304f\u3001\u308f\u3056\u308f\u3056\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u306f\u306a\u3044\u3002<br \/>\n\u4e3b\u306b\u3001\u30c7\u30d0\u30c3\u30b0\u7b49\u306e\u958b\u767a\u306e\u304a\u52a9\u3051\u7b49\u3005\u3067\u4f7f\u7528\u3055\u308c\u308b\u3060\u3051\u3067\u3042\u308b\u3002<\/p>\n<p>\u304c\u3001\u305f\u307e\u306b\u4f7f\u3048\u308b\u6642\u304c\u3042\u308b\u3002<\/p>\n<p>\u305d\u308c\u306f\u3001\u305f\u3081\u606f\u304c\u51fa\u308b\u3088\u3046\u306a\u6570\u5b57\u306e\u9023\u7d9a\u306b\u51fa\u4f1a\u3063\u305f\u6642\u306a\u3069\u3067\u3042\u308b\u3002<\/p>\n<p>\u300c\u30db\u30c6\u30eb\u30af\u30e9\u30b9\u306b\u90e8\u5c4b\u540d\u3092\u6301\u305f\u305b\u305f\u3044\u3002\u300d<br \/>\n\u300c\u5c0f\u3055\u3044\u30db\u30c6\u30eb\u3060\u305710\u90e8\u5c4b\u307b\u3069\u304b\u306a\u3002\u300d<\/p>\n<p>\u305d\u3057\u3066\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306a\u3082\u306e\u304cHotel\u30af\u30e9\u30b9\u306b\u8ffd\u52a0\u3055\u308c\u65e2\u306b\u904b\u7528\u3055\u308c\u3066\u3044\u308b\u3002<\/p>\n<pre class=\"lang:vbnet decode:true\">    Private _RoomName1 As String = \"\"\r\n    Property RoomName1() As String\r\n        Get\r\n            Return _RoomName1\r\n        End Get\r\n        Set(ByVal value As String)\r\n            _RoomName1 = value\r\n        End Set\r\n    End Property\r\n\r\n    Private _RoomName2 As String = \"\"\r\n    Property RoomName2() As String\r\n        Get\r\n            Return _RoomName2\r\n        End Get\r\n        Set(ByVal value As String)\r\n            _RoomName2 = value\r\n        End Set\r\n    End Property\r\n\r\n    Private _RoomName3 As String = \"\"\r\n    Property RoomName3() As String\r\n        Get\r\n            Return _RoomName3\r\n        End Get\r\n        Set(ByVal value As String)\r\n            _RoomName3 = value\r\n        End Set\r\n    End Property\r\n\r\n'10\u307e\u3067 \u7565\r\n<\/pre>\n<p>\u3053\u306e\u3088\u3046\u306a\u3001\u30b3\u30fc\u30c9\u3067\u5ef6\u3005\u3068\u66f8\u304b\u308c\u3066\u3044\u308b\u3068\u304d\u306f\u3001CallByName\u304c\u5f79\u306b\u7acb\u3064\u3002<\/p>\n<p>if\u6587\u3084while\u6587\u3067\u3072\u305f\u3059\u3089\u5206\u5c90\u3055\u305b\u308b\u65b9\u6cd5\u3067\u66f8\u304f\u3068\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u308b<\/p>\n<pre class=\"lang:vbnet decode:true\">    Private Function GetRoomName(ByVal id As String) As String\r\n        Dim rName As String = \"\"\r\n        If id = 1 Then\r\n            rName = hotel.RoomName1\r\n        End If\r\n        If id = 2 Then\r\n            rName = hotel.RoomName2\r\n        End If\r\n        If id = 3 Then\r\n            rName = hotel.RoomName3\r\n        End If\r\n        Return rName\r\n    End Function<\/pre>\n<p>3\u3064\u3060\u304b\u3089\u3001\u3044\u3044\u304c\u3001\u90e8\u5c4b\u6570\u304c10\u500b\u308220\u500b\u3082\u3042\u308b\u3068\u767a\u72c2\u3057\u305d\u3046\u306b\u306a\u308b\u3002<\/p>\n<p>\u914d\u5217\u3084\u30ea\u30b9\u30c8\u306b\u5165\u308c\u308b\u306a\u308a\u3067\u66f8\u304d\u76f4\u3057\u305f\u304f\u306a\u308b\u304c\u3001\u3059\u3067\u306b\u904b\u7528\u3055\u308c\u3066\u305f\u308a\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u7b49\u3068\u9023\u643a\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u307b\u3046\u30821,2,3\u3068\u3044\u3046\u60b2\u60e8\u306a\u72b6\u614b\u3060\u3068\u3001\u624b\u304c\u4ed8\u3051\u3089\u308c\u306a\u3044\u3002<br \/>\n\u3055\u3089\u306b\u3053\u308c\u306b\u90e8\u5c4b\u3054\u3068\u306e\u60c5\u5831\u3092\u5165\u308c\u305f\u3044\u3068\u304b\u306a\u308b\u3068\u3001RooNameInfo1\u3001RooNameInfo2\u306a\u3069\u3068\u306a\u308b\u3068\u30fb\u30fb\u30fb\u30fb\u3002<\/p>\n<p>\u305d\u3093\u306a\u6642\u306b\u3001\u6587\u5b57\u5217\u304b\u3089\u76f4\u63a5\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308bCallByName\u304c\u91cd\u5b9d\u3059\u308b\u3002<\/p>\n<p>\u3055\u304d\u307b\u3069\u306e\u95a2\u6570\u3092\u66f8\u304d\u306a\u304a\u3059\u3068\u3001<\/p>\n<pre class=\"lang:vbnet decode:true \">    Private Function GetRoomName(ByVal id As Integer) As String\r\n        Return CallByName(hotel, \"RoomName\" &amp; id.ToString(), CallType.Get)\r\n    End Function<\/pre>\n<p>\u4e00\u884c\u3067\u6e08\u3080\u3002<\/p>\n<p>\u3082\u3061\u308d\u3093\u3001\u52d5\u4f5c\u306f\u9045\u304f\u306a\u308b\u3068\u306f\u601d\u3046\u304c\u3001\u523a\u8eab\u306b\u30bf\u30f3\u30dd\u30dd\u4e57\u305b\u308b\u3088\u3046\u306a\u4f5c\u696d\u3092\u3001\u624b\u4f5c\u696d\u3067\u3084\u308b\u3088\u3046\u306a\u3053\u3068\u7cbe\u795e\u885b\u751f\u4e0a\u3088\u308d\u3057\u304f\u306a\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u53c2\u8003\uff1a<br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/chsc1tx6%28v=vs.90%29.aspx\">http:\/\/msdn.microsoft.com\/ja-jp\/library\/chsc1tx6%28v=vs.90%29.aspx<\/a><\/p>\n<p><a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/microsoft.visualbasic.interaction.callbyname%28v=vs.110%29.aspx\">http:\/\/msdn.microsoft.com\/ja-jp\/library\/microsoft.visualbasic.interaction.callbyname%28v=vs.110%29.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>VisualBasic.NET\u306b\u306f\u3001CallByName\u3068\u3044\u3046\u95a2\u6570\u304c\u3042\u308b\u3002 \u30ea\u30d5\u30ec\u30af\u30b7\u30e7\u30f3\u3068\u3044\u3046\u7269\u306e\u7c21\u6613\u7248\u3067\u3001\u5b9f\u884c\u6642\u306b\u6587\u5b57\u5217\u304b\u3089\u3001\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u3084\u30e1\u30bd\u30c3\u30c9\u540d\u3092\u6307\u5b9a\u3067\u304d\u308b\u3002 \u307e\u3041\u3001\u3056\u3063\u304f\u308a\u3068\u30b3\u30fc\u30c9\u3092\u304b\u304f\u3002(\u30c6\u30b9\u30c8\u30b3\u30fc\u30c9\u306e\u74b0\u5883&hellip;  <a href=\"https:\/\/gomokulog.gomocool.net\/?p=379\" class=\"more-link\">more <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-379","post","type-post","status-publish","format-standard","hentry","category-visualbasic-net"],"_links":{"self":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=379"}],"version-history":[{"count":1,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions"}],"predecessor-version":[{"id":380,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=\/wp\/v2\/posts\/379\/revisions\/380"}],"wp:attachment":[{"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=379"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gomokulog.gomocool.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}