C# (CSharp) System. String Code Examples

C# (CSharp) System.String - 30 examples found. These are the top rated real world C# (CSharp) examples of System.String extracted from open source projects. You can rate examples to help us improve the quality of examples
        /// <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;
            }
        }
Example #2
0
 public BaseValidator this[String id]
 {
     get
     {
         return ((List<BaseValidator>) validators).Find(validator => validator.Id == id);
     }
 }
	public override FieldInfo GetField(String name, int lexlevel)
			{
				return GetField(name, BindingFlags.Instance |
									  BindingFlags.Static |
									  BindingFlags.Public |
									  BindingFlags.DeclaredOnly);
			}
        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;
        }
Example #5
0
 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;
     }
 }
        //-----------------------------------

        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;
            
        }
Example #7
0
		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");

		}
Example #8
0
		public CUser(String[] ConnectInfo,DataRow dr) : base(ConnectInfo)
		{
			
			//根据数据行设置用户的属性
			SetUserProperty(dr);

		}
 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();
     }
 }
        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;
        }
        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();
        }
 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;
 }
 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);
   }
 }
 private void initLabels()
 {
     PersianDate pd = new PersianDate(DateTime.Today);
     date_Lbl.Content = pd.ToShortDateString();
     newId = getNewId();
     ID_Lbl.Content = Codes.ApartmanMaskooniForooshi + " -  " + newId;
 }
Example #15
0
		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;
		}
Example #16
0
 private void OnPropertyChanged(String propertyName)
 {
     if (PropertyChanged != null)
     {
         PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
     }
 }
Example #17
0
   /*
    * (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;
   }
Example #18
0
 public Watcher(String path, Client client)
 {
     this.client = client;
     this.path = path;
     lastRead = DateTime.MinValue;
     this.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;
        }
Example #20
0
        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;
        }
Example #21
0
		private void SetPathRelatedFields(String path)
		{
			// Set the path
			this.path = path;

			// Extract the file name from the path
			if (path.IndexOf('/') == -1)
			{
				fileName = path;
			}
			else
			{
				fileName = path.Substring(path.LastIndexOf('/')+1);
			}
			
			// Extract the extension from the file name
			if (fileName.IndexOf('.') == -1)
			{
				extension = String.Empty;
			}
			else
			{
				extension = fileName.Substring(fileName.LastIndexOf('.') + 1);
			}
		}
Example #22
0
 public StudyDeleteRecord(
      String _studyInstanceUid_
     ,DateTime _timestamp_
     ,String _serverPartitionAE_
     ,ServerEntityKey _filesystemKey_
     ,String _backupPath_
     ,String _reason_
     ,String _accessionNumber_
     ,String _patientId_
     ,String _patientsName_
     ,String _studyId_
     ,String _studyDescription_
     ,String _studyDate_
     ,String _studyTime_
     ,XmlDocument _archiveInfo_
     ,String _extendedInfo_
     ):base("StudyDeleteRecord")
 {
     StudyInstanceUid = _studyInstanceUid_;
     Timestamp = _timestamp_;
     ServerPartitionAE = _serverPartitionAE_;
     FilesystemKey = _filesystemKey_;
     BackupPath = _backupPath_;
     Reason = _reason_;
     AccessionNumber = _accessionNumber_;
     PatientId = _patientId_;
     PatientsName = _patientsName_;
     StudyId = _studyId_;
     StudyDescription = _studyDescription_;
     StudyDate = _studyDate_;
     StudyTime = _studyTime_;
     ArchiveInfo = _archiveInfo_;
     ExtendedInfo = _extendedInfo_;
 }
Example #23
0
        public DataTable ObtenerDatos(String ComandoSql)
        {
            SqlDataAdapter adapter;
            DataTable dt = new DataTable();

            try
            {
                con.Open();
                Cmd.Connection = con;
                Cmd.CommandText = ComandoSql;

                adapter = new SqlDataAdapter(Cmd);
                adapter.Fill(dt);

            }
            catch (Exception ex)
            {
                throw ex;
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }

            return dt;
        }
	public override void  SetUp()
	{
		base.SetUp();
		
		
		System.String[] data = new System.String[]{"A 1 2 3 4 5 6", "Z       4 5 6", null, "B   2   4 5 6", "Y     3   5 6", null, "C     3     6", "X       4 5 6"};
		
		index = new RAMDirectory();
		IndexWriter writer = new IndexWriter(index, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
		
		for (int i = 0; i < data.Length; i++)
		{
			Document doc = new Document();
			doc.Add(new Field("id", System.Convert.ToString(i), Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("id",String.valueOf(i)));
			doc.Add(new Field("all", "all", Field.Store.YES, Field.Index.NOT_ANALYZED)); //Field.Keyword("all","all"));
			if (null != data[i])
			{
				doc.Add(new Field("data", data[i], Field.Store.YES, Field.Index.ANALYZED)); //Field.Text("data",data[i]));
			}
			writer.AddDocument(doc);
		}
		
		writer.Optimize();
		writer.Close();
		
		r = IndexReader.Open(index, true);
		s = new IndexSearcher(r);
		
		//System.out.println("Set up " + getName());
	}
        public List<Curso> find_by(String nome, String responsavel)
        {
            var con = db();

            return con.Curso.Where(Curso => Curso.nom_curso.Contains(nome) &&
                                            Curso.Professor.nom_prof.Contains(responsavel)).ToList();
        }
Example #26
0
 /**
 * Creates a PdfCollectionField.
 * @param name      the field name
 * @param type      the field type
 */
 public PdfCollectionField(String name, int type)
     : base(PdfName.COLLECTIONFIELD)
 {
     Put(PdfName.N, new PdfString(name, PdfObject.TEXT_UNICODE));
     this.type = type;
     switch (type) {
     default:
         Put(PdfName.SUBTYPE, PdfName.S);
         break;
     case DATE:
         Put(PdfName.SUBTYPE, PdfName.D);
         break;
     case NUMBER:
         Put(PdfName.SUBTYPE, PdfName.N);
         break;
     case FILENAME:
         Put(PdfName.SUBTYPE, PdfName.F);
         break;
     case DESC:
         Put(PdfName.SUBTYPE, PdfName.DESC);
         break;
     case MODDATE:
         Put(PdfName.SUBTYPE, PdfName.MODDATE);
         break;
     case CREATIONDATE:
         Put(PdfName.SUBTYPE, PdfName.CREATIONDATE);
         break;
     case SIZE:
         Put(PdfName.SUBTYPE, PdfName.SIZE);
         break;
     }
 }
Example #27
0
 public static String ChangeExtension(String Path,String Ext)
 {
     int sindex = Path.LastIndexOf('.');
     if (sindex == -1)
         return Path;
     return Path.Remove(sindex) + '.' + Ext.Trim(' ', '.').ToLower();
 }
 // The frameworkName parameter is intended to be the string form of a FrameworkName instance.
 public TargetFrameworkAttribute(String frameworkName) 
 {
     if (frameworkName == null)
         throw new ArgumentNullException("frameworkName");
     Contract.EndContractBlock(); 
     _frameworkName = frameworkName;
 } 
Example #29
0
        void Init(String domainName, String connStringName, Boolean pSecure, bool chekControllers)
        {
            //_LdapWrapper = new LdapWrapper();

            //LoadControllersFromDatabase( pConnString);


            _DomainUrlInfo = DomainsUrl_Get_FromSp(connStringName, domainName);// _DomainUrlInfoList.First<DomainUrlInfo>(p => p.DomainName == domainName);
            if (_DomainUrlInfo == null)
            {
                throw new Fwk.Exceptions.TechnicalException("No se encontró la información del dominio especificado");
            }

            if (chekControllers)
            {
                _DomainControllers = GetDomainControllersByDomainId(System.Configuration.ConfigurationManager.ConnectionStrings[connStringName].ConnectionString, _DomainUrlInfo.Id);
                if (_DomainControllers == null || _DomainControllers.Count == 0)
                    throw new Fwk.Exceptions.TechnicalException("No se encuentra configurado ningún controlador de dominio para el sitio especificado.");


                // Prueba de conectarse a algún controlador de dominio disponible, siempre arranando del primero. debería 
                // TODO: reemplazarse por un sistema de prioridad automática para que no intente conectarse primero a los funcionales conocidos
                //LdapException wLastExcept = GetDomainController(pSecure, _DomainControllers);
                if (_DomainController == null)
                {
                    throw new Fwk.Exceptions.TechnicalException("No se encontró ningún controlador de dominio disponible para el sitio especificado.");//, wLastExcept);
                }
            }
        }
Example #30
0
        [System.Security.SecuritySafeCritical]  // auto-generated
        protected unsafe Delegate(Type target,String method)
        {
            if (target == null)
                throw new ArgumentNullException("target");

            if (target.IsGenericType && target.ContainsGenericParameters)
                throw new ArgumentException(Environment.GetResourceString("Arg_UnboundGenParam"), "target");

            if (method == null)
                throw new ArgumentNullException("method");
            Contract.EndContractBlock();

            RuntimeType rtTarget = target as RuntimeType;
            if (rtTarget == null)
                throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), "target");

            // This API existed in v1/v1.1 and only expected to create open
            // static delegates. Constrain the call to BindToMethodName to such
            // and don't allow relaxed signature matching (which could make the
            // choice of target method ambiguous) for backwards compatibility.
            // The name matching was case insensitive (no idea why this is
            // different from the constructor above) and we preserve that as
            // well.
            BindToMethodName(null, rtTarget, method,
                             DelegateBindingFlags.StaticMethodOnly |
                             DelegateBindingFlags.OpenDelegateOnly |
                             DelegateBindingFlags.CaselessMatching);
        }