|
You may add some where to your select?
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
then it is same as mentioning like this
var yy = t1.Name + t1.rr
i want to avoid that
|
|
|
|
|
I didn't get you...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
I have a need to concat some property values of a class let's say
public class t1
{
public string Name { get; set; }
public string rr { get; set; }
public string ss { get; set; }
public string yy { get; set; }
}
easy way is
var yy = string.Join("", typeof(t1).GetProperties().Select(x => x.GetValue(ttt)));
but then it will have all the properties
i want a way in which i can specify the properties which i want to exclude from concatenating.
one way is i mention all the properties which i want to concat like this
var yy = t1.Name + t1.rr;
but then this is old fashioned and i have a class which has 70+ properties so it is laborious
i want a shortcut.
Hopr i make myself clear
|
|
|
|
|
So. That what I suggest. Add some where on property name to exclude them...
You also can add some custom attribute to the properties you want to access and get only properties that have the specific attribute...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
not sure what you mean
can you write a line for the snippet
|
|
|
|
|
var oProperties = typeof(t1).GetProperties().Where(oProp => Attribute.IsDefined(oProp, typeof(MyAttribute)));
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Hi,
I am looking for a solution where I can drag an email from Microsoft Outlook (running exchange) onto a Windows Forms application and have the email saved into an .eml file.
I have searched for a solution to this but came up empty handed. I have also checked Microsoft white papers and nada.
Please assist if you can

|
|
|
|
|
|
I found that article previously but how would I save the message into a .eml file so that users can open the .eml file at a later stage if they wanted to?
|
|
|
|
|
Oh great! That project saves it to a *.msg file which can be opened later on, what a difference!
|
|
|
|
|
Thank you very much for your help
|
|
|
|
|
Hi,
I have created a setup for my windows application developed in C# and SQL Server 2008. I'm able to install the project in any machine having sql server. But the problem is when I use the application in another user account in the same machine it shows "Cannot open database "dbname" requested by login. The login failed. Login failed for the user"username".". I'm using windows authentication for SQL login kindly give solution.
Thanks & Regards
Manoj Kumar
|
|
|
|
|
manumaxma wrote: when I use the application in another user account That user would need access to the database; start here[^].
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi,
I am creating a simple application which selects 50 random rows from the list of 500 rows. I am using a DataGridView to output the results. I would like to know if its possible to output/print those 50 rows line by line(5 lines every 3 second)? To be more clear, i want 5 row from the sql result to append to datagridview's list every 3 seconds with the list scrolling down. This way one can see what all names are being printed.
Please let me know if this would be possible to do and how.
Any help would be appreciated.
Thanks,
Sukriti
|
|
|
|
|
Yes, you can...but it's not very nice.
You would need to add a Timer, then read all your lines into a collection of some form.
In the timer Tick event, you would remove an item from the collection, add it to the DataGridView and then scroll the DGV to ensure it is visible (using CurrentCell will do it).
Alternatively, you can do much the same without the timer by moving the code into a BackgroundWorker thread and using Invoke on the DGV to add the new row and ensure it's visible. You would then sleep the thread between updates.
It would probably annoy the heck out of me as a user though.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
|
<pre>
int[] array = {1,2,3,4,5};
for (int i = 0; i < 5; i++)
Console.WriteLine("{0}", array[i]);
|
|
|
|
|
I prefer to use a Generic method to handle sorting any Type:
private T[] ShuffleArray<T>(T[] theArray)
{
Random rnd = new Random((int) DateTime.Now.Ticks & 0x0000FFFF);
return theArray.OrderBy(itm => rnd.Next()).ToArray();
} Examples of use:
int[] theInts = new int[]{1,2,3,4,5};
theInts = ShuffleArray(theInts);
string[] theStrings = new string[] {"a", "b", "c", "d","e","f"};
theStrings = ShuffleArray(theStrings); I used the code in this 2008 StackOverFlow thread for the shuffling routine shown here, but adapted it myself to be generic: [^].
I strongly suggest you study that SO thread; it has a variety of techniques presented, and good discussion of issues.
The technique I'm using here is not as "powerful," and fast, as other techniques: your specific Application may need/require stronger methods, including, possibly, the use of the Cryptographic Random generator in .NET; see: [^] for an example that uses 'OrderBy with the Cryptographic Random generator.
“The best hope is that one of these days the Ground will get disgusted enough just to walk away ~ leaving people with nothing more to stand ON than what they have so bloody well stood FOR up to now.” Kenneth Patchen, Poet
|
|
|
|
|
Interesting link provided
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
This is a very very funny. But it doesn't help me. lol..
|
|
|
|
|
I replied to Bill stating that it was a good link as I personally found it a good read and some of the links inside are also worth reading
Bill also showed you a good method of shuffling the array.
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
I don't understand his example. I have been playing with it all morning. I am very new to this and I am trying to learn. I simply want to move the around the contents randomly.
int[] array = {1,2,3,4,5};
for (int i = 0; i < 5; i++)
Console.WriteLine("{0}", array[i]);
|
|
|
|
|
int[] arrayValues = {1,2,3,4,5,6};
Random rnd = new Random((int)DateTime.Now.Ticks & 0x0000FFFF);
arrayValues = arrayValue.Orderby(itm => rnd.Next()).ToArray();
have a read of these, as the solution covers a range of topics but does what you are after. I am afraid to say that you are going to have do some background reading to get yourself up to speed.
datetime.now.ticks[^]
LINQ Tutorial for Beginners[^]
Every day, thousands of innocent plants are killed by vegetarians.
Help end the violence EAT BACON
|
|
|
|
|
Your solution doesn't really help me. I want to shuffle the contents INSIDE the array. So when I index array[0], the value at index array[0] should always be different.
|
|
|
|