|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
They do this in C# can't we do it in VB??They do this in C# can't we do it in VB??
Public Structure DevicePropMap Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028} End Structure 'DevicePropMap " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message Store 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028 as a news:OVauVviGGHA.3700@TK2MSFTNGP15.phx.gbl... > They do this in C# can't we do it in VB?? > > Public Structure DevicePropMap > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, > 14, 15, 1026, 1027, 1028} > > End Structure 'DevicePropMap string and parse/tokenize it? " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: Mhm... The code semantically doesn't make sense.> They do this in C# can't we do it in VB?? > > Public Structure DevicePropMap > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, > 14, 15, 1026, 1027, 1028} > > > End Structure 'DevicePropMap -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb It works with classes, why not with structures? It's just a member of the > " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: > > They do this in C# can't we do it in VB?? > > > > Public Structure DevicePropMap > > > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, > > 12, 13, 14, 15, 1026, 1027, 1028} > > > > > > End Structure 'DevicePropMap > > Mhm... The code semantically doesn't make sense. type. Armin
Show quote
Hide quote
"Armin Zingler" <az.nospam@freenet.de> schrieb: Could you describe a scenario where the code above would semantically make >> > They do this in C# can't we do it in VB?? >> > >> > Public Structure DevicePropMap >> > >> > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, >> > 12, 13, 14, 15, 1026, 1027, 1028} >> > >> > >> > End Structure 'DevicePropMap >> >> Mhm... The code semantically doesn't make sense. > > It works with classes, why not with structures? It's just a member of the > type. sense? -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Show quote
Hide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb This is not the answer to my question. ;-) At the same places where it makes > "Armin Zingler" <az.nospam@freenet.de> schrieb: > > > > They do this in C# can't we do it in VB?? > > > > > > > > Public Structure DevicePropMap > > > > > > > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, > > > > 11, 12, 13, 14, 15, 1026, 1027, 1028} > > > > > > > > > > > > End Structure 'DevicePropMap > > > > > > Mhm... The code semantically doesn't make sense. > > > > It works with classes, why not with structures? It's just a member > > of the type. > > Could you describe a scenario where the code above would > semantically make sense? sense with classes. Armin "Armin Zingler" <az.nospam@freenet.de> wrote in message In the dark days, you could do thisnews:eXPwWVuGGHA.1032@TK2MSFTNGP12.phx.gbl... >> > > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, >> > > > 11, 12, 13, 14, 15, 1026, 1027, 1028} > This is not the answer to my question. ;-) At the same places where it > makes sense with classes. 10 DIM I(17) 20 FOR I = 1 TO 17 30 READ I(I) 40 NEXT I 10000 DATA 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028 .... but not these days! "Homer J Simpson" <nob***@nowhere.com> schrieb Still possible on my CPC emulator. ;-)> In the dark days, you could do this > > 10 DIM I(17) > 20 FOR I = 1 TO 17 > 30 READ I(I) > 40 NEXT I > 10000 DATA 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, > 1027, 1028 > > ... but not these days! Armin Hi,
Use a class instead of a structure Public Class DevicePropMap Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1026, 1027, 1028} End Class 'DevicePropMap Ken -------------- Show quoteHide quote " **Developer**" <REMOVEdevelo***@a-znet.com> wrote in message news:OVauVviGGHA.3700@TK2MSFTNGP15.phx.gbl... > They do this in C# can't we do it in VB?? > > Public Structure DevicePropMap > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, > 14, 15, 1026, 1027, 1028} > > > End Structure 'DevicePropMap > > Which version ? AFAIK it should work in 2.0...
-- Show quoteHide quotePatrice " **Developer**" <REMOVEdevelo***@a-znet.com> a écrit dans le message de news:OVauVviGGHA.3700@TK2MSFTNGP15.phx.gbl... > They do this in C# can't we do it in VB?? > > Public Structure DevicePropMap > > Public Shared id() As Integer = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, > 15, 1026, 1027, 1028} > > > End Structure 'DevicePropMap > > "Patrice" <nob***@nowhere.com> schrieb: No, it doesn't work.> Which version ? AFAIK it should work in 2.0... BTW: I would fire a programmer who designs a structure without instance members... -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb Armin> "Patrice" <nob***@nowhere.com> schrieb: > > Which version ? AFAIK it should work in 2.0... > > No, it doesn't work. > > BTW: I would fire a programmer who designs a structure without > instance members... :-) I guess, ***Developer*** posted only the interesting part of the structure. This is the result of converting a C# program using the converter that I got
from MS. Actually the structure did have another part but it was basically the same except that the type was string. I'm beyond worrying about getting fired, but just in case, what the problem that Herfried sees? Thanks for the replies. I'll try using Class as that was the only suggestion as how to make it work. Wish me luck. Thanks Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:eiQn8OqGGHA.4036@TK2MSFTNGP12.phx.gbl... > "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> schrieb >> "Patrice" <nob***@nowhere.com> schrieb: >> > Which version ? AFAIK it should work in 2.0... >> >> No, it doesn't work. >> >> BTW: I would fire a programmer who designs a structure without >> instance members... > > > :-) I guess, ***Developer*** posted only the interesting part of the > structure. > > > Armin " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb A structure (object) is a container for data. If there's no data, there's> I'm beyond worrying about getting fired, but just in case, what the > problem that Herfried sees? no need for a structure. I only guess that this is the problem Herfried sees - and I would agree. In opposite to classes, the singleton pattern doesn't make sense with structures, in other words, if you don't intend to create an instance, a class is the better (and only) way to implement it. Or, in other words, a structure is a value type. A value type without a value does not make sense. Armin Armin,
> As I was almost writing as well. However than it did look me to silly to > Or, in other words, a structure is a value type. A value type without a > value does not make sense. > write, as you I assumed that it was partial code. Cor "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb Pardon?> Armin, > > > > > Or, in other words, a structure is a value type. A value type > > without a value does not make sense. > > > As I was almost writing as well. However than it did look me to > silly to write, as you I assumed that it was partial code. Armin Armin,
Did you know that this way of coding is the way were Cobol is very much based on. Therefore it is maybe not impossible that some developpers still use (mimic) it. (Giving the same memory area different names and different structures). Cor "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> schrieb No, I don't know Cobo.> Armin, > > Did you know that this way of coding is the way were Cobol is very > much based on. > Therefore it is maybe not impossible that some Sorry Cor, I don't see the relation to the topic.> developpers still use (mimic) it. (Giving the same memory area > different names and different structures). ARmin Is the objection because there is only on variable.
Actually there were two variables. One Integer array and one String array. I think the struct mapped an id (integer) into a name (string). The string array had the same format as the integer so I tried to simplify the post. Is the objection because there is only on variable and is that what you meant by "singleton pattern"? thanks "Armin Zingler" <az.nospam@freenet.de> wrote in message Seems to me there is data - the array of integers. On the other hand putting news:uFYb7wqGGHA.2320@TK2MSFTNGP11.phx.gbl... >" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb >> I'm beyond worrying about getting fired, but just in case, what the >> problem that Herfried sees? > > > A structure (object) is a container for data. If there's no data, there's > no need for a structure. the array into a structure does not seem to add anything unless there are other variables in the structure and you want to indentify them as being related. I think I'm missing something here. Show quoteHide quote > I only guess that this is the problem Herfried > sees - and I would agree. In opposite to classes, the singleton pattern > doesn't make sense with structures, in other words, if you don't intend to > create an instance, a class is the better (and only) way to implement it. > > Or, in other words, a structure is a value type. A value type without a > value does not make sense. > > > Armin >
Show quote
Hide quote
" **Developer**" <REMOVEdevelo***@a-znet.com> schrieb The point is that there was /no/ /instance/ variable. But, ask Herfried, it > Is the objection because there is only on variable. > > Actually there were two variables. > > One Integer array and one String array. > > I think the struct mapped an id (integer) into a name (string). > > The string array had the same format as the integer so I tried to > simplify the post. > > Is the objection because there is only on variable and is that what > you meant by "singleton pattern"? was his statement. Armin " **Developer**" <REMOVEdevelo***@a-znet.com> schrieb: Two shared variables!> Is the objection because there is only on variable. > > Actually there were two variables. > One Integer array and one String array. The problem I see is that the variable is not an instance variable. > > I think the struct mapped an id (integer) into a name (string). > > The string array had the same format as the integer so I tried to simplify > the post. > > Is the objection because there is only on variable Instead, it's a shared variable. So it's irrelevant if you declare the variable in a structure or a class. I suggest to post the complete code listing and describe in more detail what you want to archieve. You may want to include the full C# snippet too. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> "Armin Zingler" <az.nospam@freenet.de> schrieb: Full ACK.>> I'm beyond worrying about getting fired, but just in case, what the >> problem that Herfried sees? > > A structure (object) is a container for data. If there's no data, there's > no need for a structure. I only guess that this is the problem Herfried > sees - and I would agree. In opposite to classes, the singleton pattern > doesn't make sense with structures, in other words, if you don't intend to > create an instance, a class is the better (and only) way to implement it. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> ACK hmmmmm ACK = 0x06 ;-)
regards Michel Show quoteHide quote "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message news:u1UcyhsGGHA.596@TK2MSFTNGP10.phx.gbl... > "Armin Zingler" <az.nospam@freenet.de> schrieb: >>> I'm beyond worrying about getting fired, but just in case, what the >>> problem that Herfried sees? >> >> A structure (object) is a container for data. If there's no data, there's >> no need for a structure. I only guess that this is the problem Herfried >> sees - and I would agree. In opposite to classes, the singleton pattern >> doesn't make sense with structures, in other words, if you don't intend >> to >> create an instance, a class is the better (and only) way to implement it. > > Full ACK. > > -- > M S Herfried K. Wagner > M V P <URL:http://dotnet.mvps.org/> > V B <URL:http://classicvb.org/petition/> |
|||||||||||||||||||||||