Required using statements
using Microsoft.SharePoint;
using Microsoft.Office.Server;
using Microsoft.Office.Server.UserProfiles;
Then sample code
try
{
site = SPContext.Current.Site;
ServerContext serverContext = ServerContext.GetContext(site);
UserProfileManager userProfileManager = new UserProfileManager(serverContext);
UserProfile currentUserUserProfile = userProfileManager.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);
string nameSurname = (string)currentUserUserProfile["preferredname"].Value;
string email = (string)currentUserUserProfile["workemail"].Value;
string companyName = (string)currentUserUserProfile["company"].Value;
}
finally
{
site.RootWeb.Dispose();
site.Dispose();
}