当前位置: 首页>>代码示例>>C#>>正文


C# String.First方法代码示例

本文整理汇总了C#中System.String.First方法的典型用法代码示例。如果您正苦于以下问题:C# String.First方法的具体用法?C# String.First怎么用?C# String.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.String的用法示例。


在下文中一共展示了String.First方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ArchiveGenerationParameters

        /// <summary>
        /// Initializes a new instance of the <see cref="ArchiveGenerationParameters"/> class.
        /// </summary>
        /// <param name="args">The application's command line arguments.</param>
        public ArchiveGenerationParameters(String[] args)
        {
            if (args == null || !args.Any())
                throw new InvalidCommandLineException();

            var parser = new CommandLineParser(args);
            if (!parser.IsParameter(args.First()))
                throw new InvalidCommandLineException();

            switch (args.First().ToLowerInvariant())
            {
                case "-pack":
                    Command = ArchiveGenerationCommand.Pack;
                    ProcessPackParameters(args, parser);
                    break;

                case "-list":
                    Command = ArchiveGenerationCommand.List;
                    ProcessListParameters(args, parser);
                    break;

                default:
                    throw new InvalidCommandLineException();
            }
        }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:29,代码来源:ArchiveGenerationParameters.cs

示例2: FontGenerationParameters

        /// <summary>
        /// Initializes a new instance of the <see cref="FontGenerationParameters"/> class.
        /// </summary>
        /// <param name="args">The application's command line arguments.</param>
        public FontGenerationParameters(String[] args)
        {
            if (args == null || !args.Any())
                throw new InvalidCommandLineException();

            var parser = new CommandLineParser(args.Skip(1));
            if (parser.IsParameter(args.First()))
            {
                throw new InvalidCommandLineException();
            }

            NoBold   = parser.HasArgument("nobold");
            NoItalic = parser.HasArgument("noitalic");

            FontName = args.First();
            FontSize = parser.GetArgumentOrDefault<Single>("fontsize", 16f);
            Overhang = parser.GetArgumentOrDefault<Int32>("overhang", 0);
            PadLeft = parser.GetArgumentOrDefault<Int32>("pad-left", 0);
            PadRight = parser.GetArgumentOrDefault<Int32>("pad-right", 0);
            SuperSamplingFactor = parser.GetArgumentOrDefault<Int32>("supersample", 2);

            if (SuperSamplingFactor < 1)
                SuperSamplingFactor = 1;

            SourceText    = parser.GetArgumentOrDefault<String>("sourcetext");
            SourceFile    = parser.GetArgumentOrDefault<String>("sourcefile");
            SourceCulture = parser.GetArgumentOrDefault<String>("sourceculture");

            if (SourceText != null && SourceFile != null)
                throw new InvalidCommandLineException("Both a source text and a source file were specified. Pick one!");

            SubstitutionCharacter = parser.GetArgumentOrDefault<Char>("sub", '?');
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:37,代码来源:FontGenerationParameters.cs

示例3: enqueueChatLine

        public static void enqueueChatLine(String line)
        {
            ChatLine chat_line = new ChatLine(line);

            //Check if the message has a name
            if (line.Length > 3 && line.First() == '[')
            {
            int name_length = line.IndexOf(']');
            if (name_length > 0)
            {
                name_length = name_length - 1;
                String name = line.Substring(1, name_length);
                if (name == "Server")
                    chat_line.color = new Color(0.65f, 1.0f, 1.0f);
                else
                    chat_line.color = KLFVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR
                                      + Color.white * (1.0f-NAME_COLOR_SATURATION_FACTOR);
            }
            }

            chatLineQueue.Enqueue(chat_line);
            while (chatLineQueue.Count > MAX_CHAT_LINES)
            chatLineQueue.Dequeue();
            scrollPos.y += 100;
        }
开发者ID:raad287,项目名称:KerbalLiveFeed,代码行数:25,代码来源:KLFChatDisplay.cs

示例4: AIRCH

 public AIRCH(String host, int port, String channel = "#terraria", String nick="IRCage", String username="IRCage", String realname="IRC support for TDSM",String nspass="", String pass = "", String quitMessage = "Bye bye!", String commandDelim = "+", bool ircColors=false)
 {
     this.host = host;
     this.port = port;
     this.nick = nick;
     this.username = username;
     this.realname = realname;
     this.channel = channel;
     this.nspass = nspass;
     this.pass = pass;
     this.quitMessage = quitMessage;
     this.commandDelim = commandDelim.First();
     this.ircColors = ircColors;
 }
开发者ID:AWRyder,项目名称:IRCage,代码行数:14,代码来源:AIRCH.cs

示例5: StartDirect

        private static void StartDirect(String[] args)
        {
            try
            {
                Common.Initialize();

                switch (args.First())
                {
                    case "-game": Common.StartGame(args.Skip(1).ToArray()); break;
                    case "-editor": Common.StartEditor(args.Skip(1).ToArray()); break;
                    default: throw new ArgumentException(@"Invalid start argument: """ + args[0] + @""", valid arguments are ""-game"" or ""-editor""");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), e.GetType().Name);
            }
        }
开发者ID:Mofsy,项目名称:SharpCraft,代码行数:18,代码来源:Program.cs

示例6: ToByteArray

 public static Byte[] ToByteArray(String s)
 {
     BigInteger bi = 0;
     // Decode base58
     foreach (Char c in s)
     {
         int charVal = base58chars.IndexOf(c);
         if (charVal >= 0)
         {
             bi *= 58;
             bi += charVal;
         }
     }
     Byte[] b = bi.ToByteArray();
     // Remove 0x00 sign byte if present.
     if (b[b.Length - 1] == 0x00)
         b = b.Take(b.Length - 1).ToArray();
     // Add leading 0x00 bytes
     int num0s = s.IndexOf(s.First(c => c != '1'));
     return b.Concat(new Byte[num0s]).Reverse().ToArray();
 }
开发者ID:LawrenceBotley,项目名称:LBitcoin,代码行数:21,代码来源:Base58String.cs

示例7: Line

 public static void Line(String line)
 {
     ChatLine chatLine = new ChatLine(line);
     if (line.Length > 3 && line.First() == '[')
     {//Check if the message starts with name
         int nameLength = line.IndexOf(']');
         if (nameLength > 0)
         {//render name colour
             nameLength = nameLength - 1;
             String name = line.Substring(1, nameLength);
             if (name == "Server")
                 chatLine.Color = new Color(0.65f, 1.0f, 1.0f);
             else
                 chatLine.Color =
                     KLFVessel.GenerateActiveColor(name) * NameColorSaturationFactor + Color.white * (1.0f - NameColorSaturationFactor);
         }
     }
     ChatLineQueue.Enqueue(chatLine);
     while (ChatLineQueue.Count > MaxChatLines)
         ChatLineQueue.Dequeue();
     ScrollPos.y += 100;
 }
开发者ID:velusip,项目名称:KerbalLiveFeed,代码行数:22,代码来源:KLFChatDisplay.cs

示例8: ChatLine

            public ChatLine(String line)
            {
                this.color = Color.yellow;
                this.name = "";
                this.message = line;

                //Check if the message has a name
                if (line.Length > 3 && line.First() == '[')
                {
                    int name_length = line.IndexOf(']');
                    if (name_length > 0)
                    {
                        name_length = name_length - 1;
                        this.name = line.Substring(1, name_length);
                        this.message = line.Substring(name_length + 2);

                        if (this.name == "Server")
                            this.color = Color.magenta;
                        else this.color = KMPVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR
                            + Color.white * (1.0f - NAME_COLOR_SATURATION_FACTOR);
                    }
                }
            }
开发者ID:rekcon,项目名称:KerbalMultiPlayer,代码行数:23,代码来源:KMPChatDX.cs

示例9: TrimNonLetterPrefix

 public static String TrimNonLetterPrefix(String word)
 {
     var firstLetter = word.First(Char.IsLetter);
     if (word.IndexOf(firstLetter) != 0)
         return word.Substring(word.IndexOf(firstLetter));
     else
         return word;
 }
开发者ID:spati2,项目名称:FSE-2012-SANDO,代码行数:8,代码来源:DictionaryHelper.cs

示例10: ChatLine

            public ChatLine(String line)
            {
                this.color = Color.yellow;
                this.name = "";
                this.message = line;
                this.isAdmin = false;

                //Check if the message has a name
                if (line.Length > 3 && (line.First() == '<' || (line.StartsWith("["+KMPCommon.ADMIN_MARKER+"]") && line.Contains('<'))))
                {
                    int name_start = line.IndexOf('<');
                    int name_end = line.IndexOf('>');
                    int name_length = name_end - name_start - 1;
                    if (name_length > 0)
                    {
                        this.name = line.Substring(name_start+1, name_length);
                        this.message = line.Substring(name_end + 1);

                        if (this.name == "Server")
                            this.color = Color.magenta;
                        else if (line.StartsWith("["+KMPCommon.ADMIN_MARKER+"]")) {
                            this.color = Color.red;
                            this.isAdmin = true;
                        } else this.color = KMPVessel.generateActiveColor(name) * NAME_COLOR_SATURATION_FACTOR
                            + Color.white * (1.0f - NAME_COLOR_SATURATION_FACTOR);
                    }
                }
            }
开发者ID:kdavison,项目名称:KerbalMultiPlayer,代码行数:28,代码来源:KMPChatDX.cs

示例11: GetConfigLine

 private String[] GetConfigLine(String CompanyName, String UserName)
 {
     String[] RDConfigLine = new String[] { };
     foreach (String RDConfiguration in RDConfigurations.Values)
     {
         if (!String.IsNullOrEmpty(RDConfiguration))
         {
             RDConfigLine = RDConfiguration.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
             if ((RDConfigLine.First() == CompanyName) && (GetValue(RDConfigLine[1]) == UserName))
             {
                 break;
             }
         }
     }
     return (RDConfigLine);
 }
开发者ID:JonatanTorino,项目名称:RDP-Assistance,代码行数:16,代码来源:RDPAssistance.cs

示例12: OpenFirmware

 private void OpenFirmware(String[] Files)
 {
     if (Files == null) Source.OpenFirmware();
     else Source.OpenFirmware(Files.First());
 }
开发者ID:NpoSaut,项目名称:netRemoteUpdater,代码行数:5,代码来源:MainViewModel.cs

示例13: GetSelectedColRow

 /// <summary>
 /// Get current col & row based on cell name
 /// </summary>
 /// <param name="name">Cell selected</param>
 /// <param name="col">Column number</param>
 /// <param name="row">Row number</param>
 private void GetSelectedColRow(String cellName, out int col, out int row)
 {
     int rowNum;
     int.TryParse(cellName.Substring(1), out rowNum);
     col = cellName.First<char>() - 'A';
     row = rowNum - 1;
 }
开发者ID:hodgeskyjon,项目名称:3505_Spring_Project,代码行数:13,代码来源:Form1.cs

示例14: BuildSubfields

        /// <summary>
        /// The build subfields.
        /// </summary>
        /// <returns>The <see cref="bool" />.</returns>
        private bool BuildSubfields()
        {
            var subFields = new String(this._arrayDescription.Skip(this._arrayDescription.LastIndexOf('*')).ToArray());

            if (subFields.First() == '*')
            {
                this.RepeatingSubfields = true;
            }

            List<string> subfieldNames = subFields.Split('!').ToList();

            foreach (string subField in subfieldNames)
            {
                this.SubFieldDefinitions.Add(new DdfSubFieldDefinition { Name = subField });
            }

            return true;
        }
开发者ID:bedane,项目名称:Iso8211-Reader,代码行数:22,代码来源:DDFFieldDefinition.cs

示例15: Text

 /// <summary>
 /// Creates a <see cref="TextExpression"/> that represents a string or a character from specified source string.
 /// </summary>
 /// <param name="symbols">The symbol table for the expression.</param>
 /// <param name="text">The string which contains quoting characters..</param>
 /// <returns>An <see cref="TextExpression"/> which generates a string or a character from specified string.</returns>
 public static TextExpression Text(SymbolTable symbols, String text)
 {
     return String.IsNullOrEmpty(text) || text.First() != text.Last()
         ? Text(symbols, default(Char), text)
         : Text(symbols, text.First(), text.Substring(1, text.Length - 2));
 }
开发者ID:takeshik,项目名称:yacq,代码行数:12,代码来源:TextExpression.cs


注:本文中的System.String.First方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。