本文整理汇总了C#中System.String类的典型用法代码示例。如果您正苦于以下问题:C# String类的具体用法?C# String怎么用?C# String使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
String类属于System命名空间,在下文中一共展示了String类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: return
public BaseValidator this[String id]
{
get
{
return ((List<BaseValidator>) validators).Find(validator => validator.Id == id);
}
}
开发者ID:lucaslra,项目名称:SPM,代码行数:7,代码来源:ValidatorCollection.cs
示例2: LoadEvents
private static Dictionary<DateTime, String> LoadEvents(String filePath)
{
List<String> activities = new List<String>();
List<DateTime> timestamps = new List<DateTime>();
Dictionary<DateTime, String> events = new Dictionary<DateTime, String>();
int k = 0;
foreach (String line in File.ReadAllLines(filePath))
{
string[] tokens = line.Split(new char[] { ';' });
Console.WriteLine("Line " + k);
timestamps.Add(DateTime.Parse(tokens[0]));
activities.Add(tokens[1]);
events.Add(DateTime.Parse(tokens[0]), tokens[1]);
Console.WriteLine("Timestamp per line " + DateTime.Parse(tokens[0]) + " Activity = " + tokens[1]);
k++;
}
var tsArray = timestamps.ToArray();
var actArray = activities.ToArray();
Console.WriteLine("tsArray length " + tsArray.Length + ", actArray length " + actArray.Length);
for (int j = 0; j < tsArray.Length; j++)
{
Console.WriteLine("tsArray[" + j + "] = " + tsArray[j].ToString() + " -- actArray[" + j + "] = " + actArray[j].ToString());
}
SimulateReadingFile(events);
return events;
}
开发者ID:imanhelal,项目名称:RuntimeDeductionCaseID,代码行数:31,代码来源:Program.cs
示例3: GetField
public override FieldInfo GetField(String name, int lexlevel)
{
return GetField(name, BindingFlags.Instance |
BindingFlags.Static |
BindingFlags.Public |
BindingFlags.DeclaredOnly);
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:GlobalScope.cs
示例4: BuscarClienteD
//-----------------------------------
public List<Cliente> BuscarClienteD(String apellido, String nombre, String mail, Decimal documento)
{
var query = String.Format(@"Select * FROM LA_REVANCHA.CLIENTE WHERE 1 = 1 ");
if (apellido != "")
{
query = query + "AND CLI_APELLIDO = '" + apellido + "' ";
}
if (nombre != "")
{
query = query + "AND CLI_NOMBRE = '" + nombre + "' ";
}
if (documento != 0)
{
query = query + "AND CLI_NUMERO_IDENTIFICACION = " + documento;
}
if (mail != "")
{
query = query + "AND CLI_MAIL = '" + mail + "' ";
}
DataRowCollection dataRow = SQLUtils.EjecutarConsultaSimple(query, "LA_REVANCHA.CLIENTE");
var clientes = dataRow.ToList<Cliente>(this.DataRowToCliente);
return clientes;
}
开发者ID:cthaeh,项目名称:NINIRODIE-HOTEL,代码行数:29,代码来源:RepositorioCliente.cs
示例5: Initialise
public void Initialise(IConfigSource config)
{
try
{
m_config = config.Configs["SimianGrid"];
if (m_config != null)
{
m_simianURL = m_config.GetString("SimianServiceURL");
if (String.IsNullOrEmpty(m_simianURL))
{
// m_log.DebugFormat("[SimianGrid] service URL is not defined");
return;
}
InitialiseSimCap();
SimulatorCapability = SimulatorCapability.Trim();
m_log.InfoFormat("[SimianExternalCaps] using {0} as simulator capability",SimulatorCapability);
}
}
catch (Exception e)
{
m_log.ErrorFormat("[SimianExternalCaps] initialization error: {0}",e.Message);
return;
}
}
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:26,代码来源:SimianGrid.cs
示例6: SetupAutoCADIOContainer
/// <summary>
/// Does setup of AutoCAD IO.
/// This method will need to be invoked once before any other methods of this
/// utility class can be invoked.
/// </summary>
/// <param name="autocadioclientid">AutoCAD IO Client ID - can be obtained from developer.autodesk.com</param>
/// <param name="autocadioclientsecret">AutoCAD IO Client Secret - can be obtained from developer.autodesk.com</param>
public static void SetupAutoCADIOContainer(String autocadioclientid, String autocadioclientsecret)
{
try
{
String clientId = autocadioclientid;
String clientSecret = autocadioclientsecret;
Uri uri = new Uri("https://developer.api.autodesk.com/autocad.io/us-east/v2/");
container = new AIO.Operations.Container(uri);
container.Format.UseJson();
using (var client = new HttpClient())
{
var values = new List<KeyValuePair<string, string>>();
values.Add(new KeyValuePair<string, string>("client_id", clientId));
values.Add(new KeyValuePair<string, string>("client_secret", clientSecret));
values.Add(new KeyValuePair<string, string>("grant_type", "client_credentials"));
var requestContent = new FormUrlEncodedContent(values);
var response = client.PostAsync("https://developer.api.autodesk.com/authentication/v1/authenticate", requestContent).Result;
var responseContent = response.Content.ReadAsStringAsync().Result;
var resValues = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseContent);
_accessToken = resValues["token_type"] + " " + resValues["access_token"];
if (!string.IsNullOrEmpty(_accessToken))
{
container.SendingRequest2 += (sender, e) => e.RequestMessage.SetHeader("Authorization", _accessToken);
}
}
}
catch (System.Exception ex)
{
Console.WriteLine(String.Format("Error while connecting to https://developer.api.autodesk.com/autocad.io/v2/", ex.Message));
container = null;
throw;
}
}
开发者ID:CADblokeCADforks,项目名称:library-dotnet-autocad.io,代码行数:42,代码来源:AutoCADIOUtilities.cs
示例7: RepositoryFile
public RepositoryFile(IRepository repository, String path, RepositoryStatus contentsStatus, RepositoryStatus propertiesStatus)
{
if (path == null)
throw new ArgumentNullException("path");
if (path.Trim().Length == 0)
throw new ArgumentException("Path must be set to a valid path", "path");
if (path[path.Length-1] == '/')
throw new ArgumentException("Path must be set to a file, not a directory", "path");
if (propertiesStatus == RepositoryStatus.Added ||
propertiesStatus == RepositoryStatus.Deleted)
{
throw new ArgumentException("Properties status cannot be set to Added or Deleted, use Updated", "propertiesStatus");
}
this.contentsStatus = contentsStatus;
this.propertiesStatus = propertiesStatus;
this.repository = repository;
SetPathRelatedFields(path);
if (fileName.EndsWith(" "))
throw new ArgumentException("Filename cannot end with trailing spaces", "path");
if (fileName.StartsWith(" "))
throw new ArgumentException("Filename cannot begin with leading spaces", "path");
}
开发者ID:atczyc,项目名称:castle,代码行数:26,代码来源:RepositoryFile.cs
示例8: CUser
public CUser(String[] ConnectInfo,DataRow dr) : base(ConnectInfo)
{
//根据数据行设置用户的属性
SetUserProperty(dr);
}
开发者ID:jquery2005,项目名称:GMIS,代码行数:7,代码来源:CUser.cs
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
IUnityContainer container = new UnityContainer();
UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
section.Configure(container);
if (Request["installation"] != null)
{
int installationid = Int32.Parse(Request["installation"]);
userid = Int32.Parse(Request["userid"]);
user = Request["user"];
sservice = container.Resolve<IStatisticService>();
IInstallationBL iinstall = container.Resolve<IInstallationBL>();
imodel = iinstall.getInstallation(installationid);
Dictionary<InstallationModel, List<InstallationState>> statelist = sservice.getInstallationState(imodel.customerid);
StringBuilder str = new StringBuilder();
str.Append("<table border = '1'><tr><th>Description</th><th>Messwert</th><th>Einheit</th></tr>");
foreach (var values in statelist)
{
if(values.Key.installationid.Equals(installationid))
{
foreach (var item in values.Value)
{
str.Append("<tr><td>" + item.description + "</td><td>" + item.lastValue + "</td><td>" + item.unit + "</td></tr>");
}
break;
}
}
str.Append("</table>");
anlagenzustand.InnerHtml = str.ToString();
}
}
开发者ID:daniel9992000,项目名称:bif5-sks-csharp,代码行数:31,代码来源:InstallationDetail.aspx.cs
示例10: Decrypt
public String Decrypt(String input)
{
String decryptedDataString = null;
try
{
// Derive a key from the password.
IBuffer derivedKeyBuffer = DeriveKeyFromPassword();
// Convert the initialization vector string to binary.
IBuffer ivBuffer = CryptographicBuffer.ConvertStringToBinary(ivString, BinaryStringEncoding.Utf8);
// Decrypt the input.
IBuffer decryptedDataBuffer = DecryptDataBuffer(derivedKeyBuffer, input, cipherAlgName, ivBuffer);
if (decryptedDataBuffer == null)
{
return null;
}
decryptedDataString = CryptographicBuffer.ConvertBinaryToString(Windows.Security.Cryptography.BinaryStringEncoding.Utf8, decryptedDataBuffer);
}
catch (Exception e)
{
// Ignroe errors;
}
return decryptedDataString;
}
开发者ID:bennettp123,项目名称:NodeUsageMeter,代码行数:25,代码来源:CredentialsEncrypter.cs
示例11: Read
public void Read(ByteArray bs)
{
signature = bs.ReadStringNull();
streamVersion = bs.ReadInt();
unityVersion = bs.ReadStringNull();
unityRevision = bs.ReadStringNull();
minimumStreamedBytes = bs.ReadInt();
headerSize = bs.ReadUInt();
numberOfLevelsToDownload = bs.ReadInt();
int numberOfLevels = bs.ReadInt();
for (int i = 0; i < numberOfLevels; i++)
{
levelByteEnd.Add(new LevelInfo() { PackSize = bs.ReadUInt(), UncompressedSize = bs.ReadUInt() });
}
if (streamVersion >= 2)
{
completeFileSize = bs.ReadUInt();
}
if (streamVersion >= 3)
{
dataHeaderSize = bs.ReadUInt();
}
bs.ReadByte();
}
开发者ID:hexiaoweiff8,项目名称:AssetBundleReader,代码行数:29,代码来源:AssetBundleHeader.cs
示例12: CollaboratingWorkbooksEnvironment
private CollaboratingWorkbooksEnvironment(String[] workbookNames, WorkbookEvaluator[] evaluators, int nItems)
{
Hashtable m = new Hashtable(nItems * 3 / 2);
Hashtable uniqueEvals = new Hashtable(nItems * 3 / 2);
for (int i = 0; i < nItems; i++)
{
String wbName = workbookNames[i];
WorkbookEvaluator wbEval = evaluators[i];
if (m.ContainsKey(wbName))
{
throw new ArgumentException("Duplicate workbook name '" + wbName + "'");
}
if (uniqueEvals.ContainsKey(wbEval))
{
String msg = "Attempted To register same workbook under names '"
+ uniqueEvals[(wbEval) + "' and '" + wbName + "'"];
throw new ArgumentException(msg);
}
uniqueEvals[wbEval]=wbName;
m[wbName] = wbEval;
}
UnhookOldEnvironments(evaluators);
//HookNewEnvironment(evaluators, this); - moved to Setup method above
_unhooked = false;
_evaluators = evaluators;
_evaluatorsByName = m;
}
开发者ID:missxiaohuang,项目名称:Weekly,代码行数:27,代码来源:CollaboratingWorkbooksEnvironment.cs
示例13: _addRptParams
private static void _addRptParams(IDbConnection conn, String rptUID, Params prms, String userUID, String remoteIP) {
var v_prms = new Params();
v_prms.SetValue("p_rpt_uid", rptUID);
var v_sql = "begin xlr.clear_rparams(:p_rpt_uid); end;";
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
v_sql = "begin xlr.add_rparam(:p_rpt_uid, :p_prm_name, :p_prm_type, :p_prm_val, :p_usr_uid, :p_remote_ip); end;";
foreach (var v_prm in prms) {
v_prms.SetValue("p_prm_name", v_prm.Name);
String v_prmValue;
var v_prmTypeStr = "A";
if (v_prm.Value != null) {
var v_prmType = v_prm.ParamType ?? v_prm.Value.GetType();
if (Utl.TypeIsNumeric(v_prmType)) {
v_prmTypeStr = "N";
v_prmValue = "" + v_prm.Value;
v_prmValue = v_prmValue.Replace(",", ".");
} else if (v_prmType == typeof(DateTime)) {
v_prmTypeStr = "D";
v_prmValue = ((DateTime)v_prm.Value).ToString("yyyy.MM.dd HH:mm:ss");
} else
v_prmValue = "" + v_prm.Value;
} else
continue;
v_prms.SetValue("p_prm_type", v_prmTypeStr);
v_prms.SetValue("p_prm_val", v_prmValue);
v_prms.SetValue("p_usr_uid", userUID);
v_prms.SetValue("p_remote_ip", remoteIP);
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
}
}
开发者ID:tormoz70,项目名称:Bio.Framework.8,代码行数:30,代码来源:CQueueDefaultImpl.cs
示例14: initLabels
private void initLabels()
{
PersianDate pd = new PersianDate(DateTime.Today);
date_Lbl.Content = pd.ToShortDateString();
newId = getNewId();
ID_Lbl.Content = Codes.ApartmanMaskooniForooshi + " - " + newId;
}
开发者ID:omid55,项目名称:real_state_manager,代码行数:7,代码来源:ApartmanMaskooniF.xaml.cs
示例15: RunProgam
static public bool RunProgam(String asFile, String asArgs)
{
Process myProcess = new Process();
try
{
myProcess.StartInfo.FileName = asFile;
myProcess.StartInfo.Arguments = asArgs;
myProcess.Start();
}
catch (Win32Exception e)
{
if(e.NativeErrorCode == ERROR_FILE_NOT_FOUND)
{
return false;
}
else if (e.NativeErrorCode == ERROR_ACCESS_DENIED)
{
return false;
}
}
return true;
}
开发者ID:whztt07,项目名称:HPL1Engine,代码行数:25,代码来源:ParticleSystem.cs
示例16: OnPropertyChanged
private void OnPropertyChanged(String propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
开发者ID:Kanubelkarl,项目名称:Tweet,代码行数:7,代码来源:Eintrag.cs
示例17: Content
/*
* (non-Javadoc)
*
* @see
* com.itextpdf.tool.xml.ITagProcessor#content(com.itextpdf.tool.xml.Tag,
* java.util.List, com.itextpdf.text.Document, java.lang.String)
*/
public override IList<IElement> Content(IWorkerContext ctx, Tag tag, String content) {
List<Chunk> sanitizedChunks = HTMLUtils.Sanitize(content, false);
List<IElement> l = new List<IElement>(1);
foreach (Chunk sanitized in sanitizedChunks) {
HtmlPipelineContext myctx;
try {
myctx = GetHtmlPipelineContext(ctx);
} catch (NoCustomContextException e) {
throw new RuntimeWorkerException(e);
}
if (tag.CSS.ContainsKey(CSS.Property.TAB_INTERVAL)) {
TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
}
l.Add(GetCssAppliers().Apply(tabbedChunk, tag,myctx));
} else if (null != GetLastChild(tag) && GetLastChild(tag).CSS.ContainsKey(CSS.Property.XFA_TAB_COUNT)) {
TabbedChunk tabbedChunk = new TabbedChunk(sanitized.Content);
tabbedChunk.TabCount = int.Parse(GetLastChild(tag).CSS[CSS.Property.XFA_TAB_COUNT]);
l.Add(GetCssAppliers().Apply(tabbedChunk, tag, myctx));
} else {
l.Add(GetCssAppliers().Apply(sanitized, tag, myctx));
}
}
return l;
}
开发者ID:smartleos,项目名称:itextsharp,代码行数:33,代码来源:ParaGraph.cs
示例18: Watcher
public Watcher(String path, Client client)
{
this.client = client;
this.path = path;
lastRead = DateTime.MinValue;
this.Run();
}
开发者ID:ernvalentino88,项目名称:pds_project,代码行数:7,代码来源:Watcher.cs
示例19: Run
public override int Run(String[] RemainingArguments)
{
IRavenEntity taskToFetch = new SparkTask();
var actualTaskId = "SparkTasks/" + TaskId;
taskToFetch.Id = actualTaskId;
if (TaskId == null)
{
Console.WriteLine("Please specify an Id for the task to activate");
return 0;
}
SparkTask taskToSet = SparkLogic.fetch(taskToFetch) as SparkTask;
TaskStateControl taskStateControl = new TaskStateControl();
ActiveTaskProcess taskProcessor = new ActiveTaskProcess();
if (taskToSet == null)
{
Console.WriteLine("The task specified doesn't exist");
return 0;
}
var result = taskStateControl.SetActiveTask(taskToSet);
if (result == true) { Console.WriteLine("The task was activated"); }
if (taskToSet != null && result == false)
{
taskStateControl.PauseTask();
taskStateControl.SetActiveTask(taskToSet);
Console.WriteLine("The Task was activated. The previous task was put on pause");
}
ReminderControl.StartTime = DateTime.Now;
taskProcessor.SetStartTime();
return 0;
}
开发者ID:hblanco-nearsoft,项目名称:ChronoSparkExtreme,代码行数:34,代码来源:ActivateTaskCommand.cs
示例20: MenuManager
public MenuManager(Main game, String[] strMenuTextures,
String strMenuFont, Integer2 textureBorderPadding)
: base(game)
{
this.game = game;
//nmcg - create an array of textures
this.menuTextures = new Texture2D[strMenuTextures.Length];
//nmcg - load the textures
for (int i = 0; i < strMenuTextures.Length; i++)
{
this.menuTextures[i] =
game.Content.Load<Texture2D>(@"" + strMenuTextures[i]);
}
//nmcg - load menu font
this.menuFont = game.Content.Load<SpriteFont>(@"" + strMenuFont);
//nmcg - stores all menu item (e.g. Save, Resume, Exit) objects
this.menuItemList = new List<MenuItem>();
//sets menu texture to fullscreen minus and padding on XY
this.textureRectangle = menuTextures[0].Bounds;
}
开发者ID:Resinderate,项目名称:ShadowMadness,代码行数:25,代码来源:MenuManager.cs
注:本文中的System.String类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论