|
Try applying the LowerCaseFilter to your search. Have a look at this[^] article for details.
|
|
|
|
|
This is dealing with a string "The Quick Brown Fox Jumped Over the Lazy Dog.".
But, in my project, I created index files for a bulk data and would like to search for a string using index files. I'm expecting the output ignoring case sensitivity. Please guide me to get this.
Thank you.
|
|
|
|
|
I'd like to serialize this func property of my class.
public Func<object, object, object> CostAdditionFunction { get; set; }
But if I add the [DataMember(Order = 6)] attribute to use DataContract serialisation, I get the following error:
Type 'System.DelegateSerializationHolder+DelegateEntry' with data contract name 'DelegateSerializationHolder.DelegateEntry:http://schemas.datacontract.org/2004/07/System' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Not entirely sure I understand the error, or how to resolve it...
The reason for this request is that there is a related class with a object Cost property, and because I don't know the actual type of Cost, I can't just do Cost + Cost as the object might not have a + operator defined. So the func allows me do things like CostAdditionFunction = (s, t) => ((int) s) + ((int) t); .
btw I did try using Generics to solve this as well, but that didn't work when I was trying to provide the GUI layer for these classes. But if I'm doing something utterly stupid, I'll consider alternatives!
|
|
|
|
|
I have converted my C# visual studio 2003 project to visual studio 2010(framework 4.0).
I debugged the code and finally got success to run my application. Every thing in the application seems to be proper functional, but crystal reports. When i opened the crystal report in designer mode it is opening in some sort of format that is unreadable, as i think the crystal reports could not be converted. Is there any way to get all my reports back in designer view, so that i can save my time from being designing again all my reports.
Thanks in Advance
Regards
|
|
|
|
|
Hi all,
I am using datagridview in c# windows application.I having a .dat file,i have to read the extract the data from that file and display in datagridview with checkbox's and the data.
How can i do it.
Thanks in advance.
|
|
|
|
|
You need to move the data into a container of some description. A List<>, datatable or an array and then bind that data a s the datasource to the DGV.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How do I write a C# code to calculate the average of all scores entered between 0 and 100. Use a sentinel – controlled loop variable to terminate the loop. After values are entered and the average calculated, test the average to determine whether an A, B, C, D, or F should be recorded. The scoring rubric is as follows:
A 90-100
B 80-89
C 70-79
D 60-69
F < 60
N.B Am very new to programming language and I am interested to become C# programmer.
your kind assistance in solving this problem will be appreciated.
DammyMulero
|
|
|
|
|
DammyMulero wrote: Am very new to programming language and I am interested to become C# programmer.
In that case you should start at the beginning and study the language basics before trying more advanced projects. I would suggest .NET Book Zero[^] as a great place to begin your studies.
|
|
|
|
|
|
Go here [^]
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Hope he gets the picture
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You're question looks like a homework question which in itself is not a reason for downvoting, but the lack of information is.
You have a problem (real life or homework doesn't matter) and you need an answer. What did you do to solve this problem yourself? Is the problem here that you have tried some things, but couldn't? And why not? Or don't you know how or where to start? If you want to start out programming you must have a certain idea of what you want and what direction you will take, correct? So what is that?
To answer the question, I'm a beginner I don't know where to start.
Buy a book. seriously, the internet is not good to learn new stuff from scratch. When you start out on chapter one, it will probably guide you through a "Hello World" program and gradually work up to a higher level. The problem you have here will be solved before you reach the end of the book, it's pretty basic. If you do have a problem with an exercise, come back here and ask the question, explaining what you did and ask what you can do to solve it.
Hope this helps.
V.
|
|
|
|
|
DammyMulero wrote: How do I write a C# code
By first learning the language of choice, C# in this case. Then you may begin by making notes on pieces of paper. But eventually you will need to enter the actual code in some sort of text editor (such as Notepad), perhaps even a full-blown and very complex application called an "Integrated Development Environment", but that may be beyond your abilities at this point.
|
|
|
|
|
Hi.
Please consider the following fixed values...
unsigned int value1 = 396;
unsigned int value2 = 398565;
1) The above values will change, but value1 will always be 3 digits, and value2 will always be 6 digits.
How do I....
A) Place both values into one DWORD?
b) Encode it as a 4 byte array.
So, as an example (not actual values)
396 + 398565 -> (DWORD) = 396398565 -> BYTE[] = {0x00, 0x00, 0x00, 0x00 } (whatever the hex would be)
And then, I would need to reverse it, although I think I have the code working to do that, but cant test it properly until I can get the above to work.
Thank you,
Steve
|
|
|
|
|
I still don't see why you insist on the array of bytes.
Here's a rather simple way without unsafe code:
uint a = 396 ;
uint b = 398565 ;
uint c = ( a << 20 ) | ( b & 0x0FFFFFu ) ;
byte[] d = new byte [ sizeof(uint) ] ;
for ( int i = 0 ; i < d.Length ; i++ )
{
d [ i ] = (byte ) ( ( c >> 8 * i ) & 0x0FF ) ;
}
uint e = 0 ;
for ( int i = 0 ; i < d.Length ; i++ )
{
e |= (uint) ( d [ i ] << 8 * i ) ;
}
uint f = e >> 20 ;
uint g = e & 0x0FFFFFu ;
|
|
|
|
|
FYI: I know you're not fond of converter classes, however
BitConverter.GetBytes() and
BitConverter.ToUInt32() are exactly what you want here.
|
|
|
|
|
Luc Pattyn wrote: what you want
What I want?
Actually, I also looked at some code I wrote a while back that does that sort of thing, and I found that the existing tools didn't work properly with some types (e.g. enumerations, DateTime), so I wrote my own.
Here's a taste of that technique:
private static unsafe byte[]
ToByteArray
(
object Value
,
byte[] Buffer
)
{
System.Runtime.InteropServices.GCHandle h =
System.Runtime.InteropServices.GCHandle.Alloc
( Value , System.Runtime.InteropServices.GCHandleType.Pinned ) ;
try
{
byte* b = (byte*) h.AddrOfPinnedObject().ToPointer() ;
for ( int i = 0 ; i < Buffer.Length ; i++ )
{
Buffer [ i ] = b [ i ] ;
}
}
finally
{
h.Free() ;
}
return ( Buffer ) ;
}
I may have to try this BitConverter, but I doubt I'll like it.
What I presented, though, is obviously very simple, about the minimum required for the stated task.
|
|
|
|
|
Hi Luc,
This time I was going to use BitCOnverter, but because the first problem was to get 2 int values into one uint, uint32 or whatever I would need, and then convert to a byte array.
Thank you,
Stephen
|
|
|
|
|
Ah, I see that the BitConverter only works with a few, rarely used, datatypes (and not strings! ) -- I want (not need) a more general solution.
|
|
|
|
|
Hi.
This does not seem to work.
It produces the following uint:
129098304
and I need 396398565
Thank you,
Stephen
|
|
|
|
|
|
BitConverter.GetBytes(a + 1000000*b)
|
|
|
|
|
|
Hi,
Sorry, this produces a different result than required.
uint val1 = 583;
uint val2 = 728439;
I should have 583728439, which sould be (in bytes) 0x22CAFD37.
Am I doing something wrong?
Thank you,
Stephen
|
|
|
|
|