Think about how you would do it manually, with a pencil and paper.
When you have that down pat, the code should be pretty easy.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
Make an array with a position for each character code, each element a character and a bool, initialized to nul and true. Scan the two input strings S1 and S2 in parallel. Use the S1 char as index in your new array. If its char is still nul, change it to the S2 char. If it is something else, but different from the S2 char, set the bool to false. After reaching the end of S1/S2, if there are any entry in you new array with the bool set to false, the result is false.
I am sure that your professor will accept this solution method for your homework.
I have a scenario where need to generate WordProcessing Report
Here is my template sample below
First Name: «FirstName»
Last Name: «LastName»
Here First Name and Last Name are keys and corresponding Merge-fields are («FirstName» & «LastName»)
Now I have to generate a report where these key and merge-fields need to repeat number of times according to the Employee record. Example if there are fice employees in database, i need to show all five employees record one after other with FirstName and LastName in sequence.
I tried with below code. But this wont help because the key and data value does not show as per template configuration.
Can you please tell me how can i achieve this in C#?
Without seeing any code I don't know if this will help. I fixed this problem in VB by converting the icon to a bitmap with the routine below. I also use ExtractIconEx. I found that icon.ToBitmap() loses resolution for some reason. Sorry, you'll have to convert to C#.
''' Convert Icon to Bitmap with resizing.
''' <param name="ic"></param>
''' <param name="sz"></param>
Public Shared Function IconToBitmap(ByVal ic As Icon, ByVal sz As Size) As Bitmap
If ic Is Nothing Then Return Nothing
Dim sourceWidth As Integer = ic.Width
Dim sourceHeight As Integer = ic.Height
Dim dPercent As Double = 0
Dim dPercentW As Double = 0
Dim dPercentH As Double = 0
If (dPercentH < dPercentW) Then
dPercent = dPercentH
dPercent = dPercentW
Dim destWidth As Integer = (sourceWidth * dPercent)
Dim destHeight As Integer = (sourceHeight * dPercent)
Dim bm As Bitmap = New Bitmap(destWidth, destHeight, PixelFormat.Format32bppArgb)
Dim g As Graphics = Graphics.FromImage(bm)
'g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
' This gives the best quality
g.InterpolationMode = Drawing2D.InterpolationMode.NearestNeighbor
g.DrawIcon(ic, New Rectangle(0, 0, destWidth, destHeight))
I have got some assembly in my sub folder and I know how to load it.
The problem is with other assemblies in this folder that this assembly is depending on.
I'm guessing that application would search for them only in it's own directory when loading assembly and not at assembly location.
Now I know about AppDomain.AssemblyResolve, but how can I subscribe to it in my assembly so I don't have to mess around with it in my main application.
Or how can I load all dependent assemblies when my assembly is loaded.