C# equivalent strnicmp function in C language. It accepts two input strings along with the number of positions of chars to compare.
StringBuilder C#
String in C#
Ah OK, then you can invoke that method by importing the Win32 library and invoking the method
I was talking about being able to invoke the version of _strnicmp() that's already in the Win32 C runtime lib.
http://msdn.microsoft.com/en-us/library/chd90w8e(VS.80).aspx
suppose that you have this native library called C_Library.dll written in C and you want to use it within your C# code
using System;using System.Runtime.InteropServices;namespace Project{ class Program { [DllImport("C_Library.dll")] public static extern int strnicmp(string s1, string s2, int n); static void Main(string[] args) { Console.WriteLine(strnicmp("Bechir", "Bejaoui", 2))); } }}
Sample code?
We can use thestrnicmp it self without converting it by using the COM interop API provided by the .Net framework