|
No subtype just different property values.
But what I wanted to do is present to users of my class library the values in a form something akin to an enum so that if they create an object and need to set the status of it you wouldn't have to use some sort of 'magic string'
|
|
|
|
|
Pity.
The "magic string" effect is a consequence of [good] advice from Microsoft WRT to maintainability of the service. If they had exposed an enum, adding new values would involve re-gen'ing the client & rebuild, also the numeric values of the enums can change.
Really the message contract types aren't OO'd in the full sense, they are close to object like data bags.
To get round this problem we have converters to convert Data Contracts from the server to pukka objects on the client side. This can be automated with a bit thought.
CCC solved so far: 2 (including a Hard One!)
37!?!! - Randall, Clerks
|
|
|
|
|
Make a static class that exposes properties that are of the proper type?
public static class StatusWrapper
{
private static StatusClass notstarted = new StatusClass ( whatever means not started ) ;
public static StatusClass NotStarted { get { return notstarted ; } }
...
}
StatusClass status = StatusWrapper.NotStarted ;
Or, if that's too ummm... static... the wrapper could use a Dictionary to map enumerated values to the status type.
|
|
|
|
|
Thanks PIEBALDconsult both of those answers may be of some use, I must admit to leaning towards the dictionary simply because its a) simple b) can hold as many statuses as the user may want to create.
Admittedly not sure how the end developer may interact with the dictionary but perhaps thats me just being dumb as not coded it yet. ![Smile | :)](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_smile.gif)
|
|
|
|
|
int[][] num = {
int[]{0, 4, 3, 4},
int[]{1, 3, 0, 0},
int[]{0, 0, 0, 0},
int[]{3, 1, 3, 0}
};
how to use LINQ to found that follow the location (vertical)
0,0
1,0
2,0
3,0
In case, result is 2;
How to count the value larger than zero?
|
|
|
|
|
try:
from n in num
from z in n
where z > 0
select new Point(n,z)
|
|
|
|
|
|
Give this a shot. The tough part was trying to figure out how to get the indexer (using Select func)
var q = from n in num.Select( ( a, index ) => new { IX = index, Arr = a } )
from z in n.Arr
where z > 0
select new {
RootIndex = n.IX,
Value = z
};
This'll flatten out the matrix and only return index/values where value > 0
![Shucks | :-\](https://codeproject.global.ssl.fastly.net/script/Forums/Images/smiley_shucks.gif)
|
|
|
|
|
I've a application running now with a database connection and wanna make a deployment of it
I tried much things. So that's why I'm asking now is there a easy guide to follow where I can see what to do.
My connection string is hard coded, after I deployed the application it's still hard coded what is the way to let the Data Source (Computer Name) change automaticly to the new computername where it is installed?
(return @"Data Source=KONING-AF02EAF7\SQLEXPRESS;Initial Catalog=KringVrienden;Integrated Security=True";)
SofwareI'm using:
Visual Studio 2008.
SQL Server 2005
SQL Management Server 2005
Please help me.
Dennis,
|
|
|
|
|
I am assuming that each of your target machine has a db server installed.
In your program use System.Environment.MachineName to get the machine name. Use this instead of the hard-coded machine name in your connection string.
Hope this helps.
|
|
|
|
|
Rather than including your development machine name, simply use ".\SQLEXPRESS" or "(local)\SQLEXPRESS" as this will point to instance "SQLEXPRESS" on the local machine.
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology (GIFT), Khuiratta Azad Kashmir
Muhammad Farooq Qadri, Khuiratta AJK
|
|
|
|
|
Dude,
You've posted this FOUR times.
http://msdn.microsoft.com/en-us/library/3e8s7xdd(VS.71).aspx
Regards,
Rob Philpott.
|
|
|
|
|
Well, its like posting the same question several times. I would suggest you go to google and try there, there are over 500,000 articles.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri, Khuiratta AJK
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri
|
|
|
|
|
|
code project is really a big project, working for IT development. Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri
|
|
|
|
|
|
string str = null;
can u tell, In the above line of code, what shall be teh memory consumption by the variable str
|
|
|
|
|
Well, str is a reference type which doesn't reference anything, so it will be just the size of reference itself. I think this will be 4 bytes for the reference itself, and a further 8 for synchronisation and other .NET internal stuff. So, likely 12 bytes.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: and a further 8 for synchronisation and other .NET internal stuff.
Can u please tell where should i read the detailed meaning of the above quoted line ?
|
|
|
|
|
Actually, I got that wrong. The extra 8 bytes would be on the heap if your reference was not null. So, just 4 bytes on a 32bit machine. Trying to find a good reference for this stuff now.
Regards,
Rob Philpott.
|
|
|
|
|
Can't find anything on the net I'm afraid. I'm sure there's lots out there if you look around though. Also, consider reading one of Jeffrey Richters books - they are excellent on this sort of stuff.
Regards,
Rob Philpott.
|
|
|
|
|