|
I hate to say it but your sig has a typo (well 2).
|
|
|
|
|
What do you mean ?
With greate code, comes greate complexity, so keep it simple stupid...
|
|
|
|
|
There's only 1 e in great.
|
|
|
|
|
|
|
Paw Jershauge wrote: Here are some basic technics:
Cool...I got it working I wrote a generic function that copies matching members from one type to the other. I'm new at this, so I was not able to come up with a good solution to a problem where I need to copy in indexed property. So Person and PersonEx have a member, MoreStuff, which in turn has other string members like Field1, Field2 etc. I also needed to copy the members of Person.MoreStuff to PersonEx.MoreStuff and just ended up calling my generic function with references to MoreStuff and it worked.
This actually worked out well, since I can now at least make sure I copy all members between similar types.
(By the way - the types are messages from BizTalk orchestrations exposed as web services. There is some wierdness with orchestrations exposed as web services, so this conversion often converts between service1.Person and service2.Person even though they are identical - only the typename is different. What a headache )
Erik Westermann - wWorkflow.net - BizTalk Consulting Services
SOA * ESB * BPI * SaaS ... forget the alphabet soup - get the main course with our consulting services!
wWorkflow.net or +1 416-809-1453
|
|
|
|
|
I think I would either use specialized converter classes, custom explicit/implicit operators, or maybe some exotic kind of software pattern. I might stay away from reflection in this case. Depending on the framework version you're using you could just hammer out an extension method that converts. In any case, the real problem here is the flawed class design (I know sometimes this can't be helped). If you can merge the functionality of the Person and PersonEx classes you won't need any tricksy conversion methods.
Hope that helps...
Regards,
Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.”
-Edsger Dijkstra
|
|
|
|
|
Reflection is working for me for now. I am using .NET 2.0 at the moment, so this might not be a problem (I think reflection had major issues in 1.0 and 1.1).
I tried writing a custom converter, but there are many similar types that need conversion and they each have lots of properties. I wanted to make sure that I covered all of the properties.
As for flawed class design - I agree that is the case. However, the types in question are actually exposed by BizTalk server through web services. I'd have to modify the underlying proxies to make the class design better. Since I won't be maintaining the solution in the future, I wanted to avoid having to customize auto-generated code. I should have mentioned all of this in the first place but I was too focused on first hand knowledge of the problem
Thanks! -Erik
Erik Westermann - wWorkflow.net - BizTalk Consulting Services
SOA * ESB * BPI * SaaS ... forget the alphabet soup - get the main course with our consulting services!
wWorkflow.net or +1 416-809-1453
|
|
|
|
|
Hi all,
I want secure pages with C#.NET and I write this code in web.config for this prepose
<authentication mode="Forms">
<forms name="myCookie" loginUrl="login.aspx" timeout="30">
<credentials passwordFormat="Clear">
<user name="myUserName" password="myPassword"/>
</credentials>
</forms>
</authentication>
<authorization>
<allow users="yekdose"/>
<deny users="?"/>
</authorization>
but in the first page I didn't access to another pages.
Please hlp me.
Thanks in advance.
|
|
|
|
|
Have you seen this[^]?
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton I gave up when I couldn't spell "egg". Justine Allen
|
|
|
|
|
|
Did you know there's an ASP.NET forum? Well there is, so you should post this in that forum, you'll probably get a much better response.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I want to find whether user selected any checkbox or not. these CheckBoxes are in Repeater.
|
|
|
|
|
You should ask this here[^] or even here[^] because it's about web development and not C#.
|
|
|
|
|
HOw is it possible to add a printer so that in add printers list it shows something like: printer1 on server1
This is similar to the name you get when you manually browse to a printer on a server i.e. \\server1\printer1
How is this possible in .net please?
Thanks
|
|
|
|
|
Please don't attempt to bump your old question higher up in the forums.
|
|
|
|
|
Apologiese, but I was trying to keep the question much simpler.
sorry.
|
|
|
|
|
arkiboys wrote: Apologiese, but I was trying to keep the question much simpler.
sorry.
That's garbage, you've been asking this question over and over again since 3 Sept.
You never answered this question[^] and now you are asking your original question, again.
led mike
|
|
|
|
|
Ok, sorry.
Thanks for your time.
|
|
|
|
|
What will I do to make this program go back at getnum/getID after the user inputs an invalid number? I mean like something that could return to the top after the Invalid Value statement. Please Help.
#include <stdio.h>
#include <conio.h>
int getID();
int main (void)
{
int getnum,y,x,w;
char c;
do{
getnum=getID();
y=getnum/10000;
w=getnum/1000;
x=w%y;
if(x != 0 || x != 1)
{
printf("INVALID VALUE!\nEnter new value: ");
}
else
{
printf("y = %d\n\nx = %d\n", y, x);
printf("do you want to continue, yes / no");
c = getch ();
}
}while (c =='y' || c=='Y');
getch();
return 0;
}
int getID()
{
int id;
printf("ID number: ");
scanf("%d", &id);
return id;
}
</conio.h></stdio.h>
bleh
modified on Monday, September 8, 2008 10:14 AM
|
|
|
|
|
Wrong forum. This is the C# forum, not C/C++.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How is this C++/CLI ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
not CLI obviously, but the printf 's and #include 's with nothing after them (presumably angle bracketed and munched as html) strongly imply vanilla c/c++ to me.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Oh, it's vanilla C++, for sure.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: How is this C++/CLI ?
I didn't say that it was...
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|