[Solved] ASP.Net Split string Error: cannot convert from string to char

mahesh213
 
on Nov 27, 2020 11:35 PM
528 Views

Getting error like cannot convert from 'string' to 'char'

 

 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Nov 27, 2020 11:38 PM

Use below code.

public void CheckMailFomat()
{
    string s = "mahesh.reddy@tcs.com";
    if (s.Split('@')[1].ToLower() == "tcs.com")
    {
        // Send mail.
    }
    else
    {
        // Don't send mail.
    }
}